[issue21879] str.format() gives poor diagnostic on placeholder mismatch

Terry J. Reedy report at bugs.python.org
Sun Jun 29 18:02:43 CEST 2014


Terry J. Reedy added the comment:

IndexError should be caught and replaced with something like
ValueError('format string requests argument not passed') or
TypeError('arguments do not match format string') or more specific
TypeError('format string requests at least %d positional arguments, only %d passed')
In Roy's example (a good testcase), the numbers would be 1 and 0.

----------
nosy: +eric.smith, terry.reedy
stage:  -> needs patch
versions: +Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21879>
_______________________________________


More information about the Python-bugs-list mailing list