Eric Smith <e...@trueblade.com> added the comment:

The attached patch (against trunk) changes the message.

However, it has at least one unintended consequence. If you have an
object with no __format__, it gets converted to a string, which is then
formatted. So you get:

>>> '{0:^10}'.format(0j)
'    0j    '
>>> '{0:^10x}'.format(0j)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Unknown presentation type x for str
>>> 

I'm calling format on an complex number, but the error says "str". The
error is correct, because the complex number has been converted to a
string before the formatting mechanism can get the actual type. I think
we'll have to live with this if we add the type to the error message.

----------
keywords: +patch
Added file: http://bugs.python.org/file13102/issue5247.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5247>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to