[issue13790] In str.format an incorrect error message for list, tuple, dict, set
py.user
report at bugs.python.org
Sun Jan 15 23:46:03 CET 2012
py.user <port139 at yandex.ru> added the comment:
also strange(unobvious) behavior:
>>> '{0:.3s}'.format((i for i in (1, 2, 3)))
'<ge'
>>> '{0:.3s}'.format(range(10))
'ran'
>>> '{0:.3s}'.format(None)
'Non'
>>>
it would be better to print an error:
ValueError: Unknown format code 's' for object of type 'generator'
like in this:
>>> '{0:d}'.format(4.5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Unknown format code 'd' for object of type 'float'
>>>
in the documentation there is nothing about it
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13790>
_______________________________________
More information about the Python-bugs-list
mailing list