[issue13811] In str.format, if invalid fill and alignment are specified, the text of the ValueError message is misleading.
Eric V. Smith
report at bugs.python.org
Thu Jan 19 00:42:36 CET 2012
Eric V. Smith <eric at trueblade.com> added the comment:
As I look at it a little closer, I think I'm going to change the message to: "Invalid format type specified". The code has determined that instead of a type that's a single character long, it's received "xx10d". That's because "xx" doesn't match any of "[[fill]align][sign][#][width][,][.precision]", so it must be the "[type]" field.
I'm open to a better message, though.
Due to the variable width chars in the format_spec string, include the "xx10d" along with the error text is a little complicated. But maybe including it would be an improvement: "Invalid format type 'xx10d' found, expected a single character".
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list