Message189068
>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__
I believe that should continue to remain an error. Please note that this works
>>> format(object(), '')
'<object object at 0xb74fd688>'
From what I can tell, specifying '1' or '2' or '100' makes no sense because unlike string or int (and like list or tuple ) this 'number' does not represent anything sensible.
This works fine as it should:
>>> format('q', '5')
'q '
>>> format(1, '5')
' 1'
>>> format(1, '05')
'00001'
>>>
But this does not and IMHO *should* not 'work'
>>> format([1,2,3], '5')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: non-empty format string passed to object.__format__
>>> format((1,2,3), '5')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: non-empty format string passed to object.__format__
an object() CANNOT have specific behavior like str or int. You can of-course argue as to what kind of error/exception/warning this may raise, but it does not make any sense (AFAIK) to 'fix' this. |
|
Date |
User |
Action |
Args |
2013-05-12 22:06:22 | Yogesh.Chaudhari | set | recipients:
+ Yogesh.Chaudhari, terry.reedy, eric.smith, Arfrever, asvetlov, flox, python-dev, krinart, Ankur.Ankan |
2013-05-12 22:06:22 | Yogesh.Chaudhari | set | messageid: <1368396382.88.0.0798872466725.issue9856@psf.upfronthosting.co.za> |
2013-05-12 22:06:22 | Yogesh.Chaudhari | link | issue9856 messages |
2013-05-12 22:06:22 | Yogesh.Chaudhari | create | |
|