New submission from Serhiy Storchaka: For example:
>>> '{:04}'.format('abc') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: '=' alignment not allowed in string format specifier There is no any '=' in the format string. >>> '{: }'.format('abc') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Sign not allowed in string format specifier There is no any sign ('+' or '-') in the format string. There also an inconsistency between the wording of "something not allowed in string format specifier" and: >>> '{:x}'.format('abc') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Unknown format code 'x' for object of type 'str' >>> '{:xx}'.format('abc') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Invalid format specifier ---------- components: Interpreter Core, Unicode messages: 276415 nosy: ezio.melotti, haypo, serhiy.storchaka priority: normal severity: normal status: open title: Confusing error examples in str.format() _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28146> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com