[Python-Dev] Int literals and method calls
Kay Schluehr
kayschluehr at gmx.de
Sun Nov 14 19:27:30 CET 2004
Hi ,
i wondered why string and bool literals have access methods and one can
call simply
>>> "1".__class__
<type 'str'>
>>> False.__class__
<type 'bool'>
But this won't be true for int literals and float literals except for
those float literals that are
terminated by a dot:
>>> 1..__class__
<type 'float'>
The expression below raises an error:
>>> 1.__class__
Traceback ( File "<interactive input>", line 1
1.__class__
^
SyntaxError: invalid syntax
So it seems to be a parser-problem, related to the ambiguity of the
terminating dot?
Could this be patched?
Thanks
Kay
More information about the Python-Dev
mailing list