For the formatting, why shouldn’t we have %i instead of %d so that we’ll get a more suggestive indication for the fact that we convert any numeric value into an integer?
Python more or less just follows the (ancient) C-style printf
codes, so you can, in fact:
In [1]: print("%i" % 10)
10
But really, for new code, f-strings are preferable to %
formatting in almost any instance.
2 Likes
It’s easier to remember that it’s %d
for decimal vs %x
for hexadecimal.
Internationalisation being the situation where you cannot use f strings.
Even then you could use .format
, no? That would still be preferable to positional %
formatting (IMO).
I think that works now, it used to not be supported by xgettext.
But I have not checked recently.
By design f string can never work for internationalisation.
1 Like