[issue9856] Change object.__format__(s) where s is non-empty to a TypeError
Yogesh Chaudhari
report at bugs.python.org
Sun May 12 19:06:33 CEST 2013
Yogesh Chaudhari added the comment:
@Eric:
when you say: "If the type of the object really is "object", then it can use string formatting. It's only for non-objects that I want to add the error.".
I am confused. Let me demonstrate what I'm thinking according to the statement above.
First let us take a 'non-object':
>>> integer=1
>>> type(integer) != object
True
As of now it returns the following:
>>> integer.__format__(s)
'1'
Which seems natural.
But after this patch should it return an error
Also now consider an object:
>>> f = object()
>>> type(f)
<class 'object'>
This will return the following after the patch as it does now which is:
>>> f.__format__('')
'<object object at 0xb75b7b48>'
Does this mean that 'integer' should give an error, however, 'f' should give something that appears messy?
I may be mistaken in my interpretation of the statement, so kindly let me know if there is something else that I am not clearly understanding.
----------
nosy: +Yogesh.Chaudhari
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9856>
_______________________________________
More information about the Python-bugs-list
mailing list