This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.smith
Recipients LambertDW, eric.smith, pitrou, rhettinger
Date 2009-02-15.21:06:30
SpamBayes Score 3.6377956e-10
Marked as misclassified No
Message-id <1234732007.56.0.398003856827.issue5247@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-02-15 21:06:47eric.smithsetrecipients: + eric.smith, rhettinger, pitrou, LambertDW
2009-02-15 21:06:47eric.smithsetmessageid: <1234732007.56.0.398003856827.issue5247@psf.upfronthosting.co.za>
2009-02-15 21:06:33eric.smithlinkissue5247 messages
2009-02-15 21:06:32eric.smithcreate