[issue33669] str.format should raise exception when placeholder number doesn't match argument number
Serhiy Storchaka
report at bugs.python.org
Mon May 28 11:13:43 EDT 2018
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
This will break the following case:
def geterrmsg(n):
return ('function doesn't have arguments' if n == 0 else
'function have a single argument' if n == 1 else
'function have %d arguments')
print(geterrmsg(n).format(n))
Actually geterrmsg() can take the error message from a translations database, and the number of different cases can be dependent on the language.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33669>
_______________________________________
More information about the Python-bugs-list
mailing list