[New-bugs-announce] [issue1413] int literal methods inaccessible

Michal Božoň report at bugs.python.org
Fri Nov 9 15:43:27 CET 2007


New submission from Michal Božoň:

It's impossible to call methods of int literals directly e.g.
1.__str__() (the same for oct literals).
Even through it works for float, hex, literals, etc..

>>> 0x1.__str__()
'1'
>>> 1e0.__str__()
'1.0'
>>> 1..__str__()
'1.0'
>>> hasattr(1, '__str__')
True
>>> 1.__str__()
  File "<stdin>", line 1
    1.__str__()
            ^
SyntaxError: invalid syntax
>>> 01.__str__()
  File "<stdin>", line 1
    01.__str__()
             ^
SyntaxError: invalid syntax

----------
messages: 57304
nosy: mykhal
severity: normal
status: open
title: int literal methods inaccessible
type: behavior
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1413>
__________________________________


More information about the New-bugs-announce mailing list