Code review comment for lp://staging/~mvo/ubuntu-release-upgrader/use-str.format

Revision history for this message
Michael Vogt (mvo) wrote :

Hi Michael, thanks for your comment. Indeed, I should have been more clear.

The issue that is fixed is:

$ python -c 'print("foo" % "bar")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: not all arguments converted during string formatting

$ python -c 'print("foo".format("bar"))'
foo

But yes, if a translation has a incorrect number of {} it will still crash, so maybe its not worth
doing all the work and instead use the "Foo %(bar)s" % { "bar": "some-str" } approach where its
also ok to leave out a argument. I.e.
$ python -c 'print("foo" % {"bar": "bar"})'
foo

« Back to merge proposal