Author eric.smith
Recipients Ankur.Ankan, Arfrever, Yogesh.Chaudhari, asvetlov, eric.smith, flox, krinart, python-dev, terry.reedy
Date 2013-05-12.20:43:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1368391395.87.0.483451609335.issue9856@psf.upfronthosting.co.za>
In-reply-to
Content
But int has its own __format__ method, so this does not apply. Per the title of this issue, this only refers to object.__format__.

For example:

This works now, and will continue working:
>>> format(2, '1')
'2'

This is currently an error, and will remain an error:
>>> class C: pass
...
>>> format(C(), '1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: non-empty format string passed to object.__format__

It's this case that is currently an error, but it need not be:
>>> format(object(), '1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: non-empty format string passed to object.__format__

The more I think about it, the more I think it would be too confusing to make object.__format__ behave differently if self is of type object, versus another type. So I'll probably just close this as fixed unless someone feels strongly about it.
History
Date User Action Args
2013-05-12 20:43:15eric.smithsetrecipients: + eric.smith, terry.reedy, Arfrever, asvetlov, flox, python-dev, krinart, Ankur.Ankan, Yogesh.Chaudhari
2013-05-12 20:43:15eric.smithsetmessageid: <1368391395.87.0.483451609335.issue9856@psf.upfronthosting.co.za>
2013-05-12 20:43:15eric.smithlinkissue9856 messages
2013-05-12 20:43:15eric.smithcreate