[Python-Dev] Re: Int literals and method calls

Scott David Daniels Scott.Daniels at Acm.Org
Sun Nov 14 21:50:00 CET 2004


Kay Schluehr wrote:
> But this won't be true for int literals and float literals ...
> The expression below raises an error:
> 
>  >>> 1.__class__
> Traceback (  File "<interactive input>", line 1
>    1.__class__
>              ^
> SyntaxError: invalid syntax
But the expressions below both work:
     >>> 2 .__class__
     <type 'int'>
     >>> (3).__class__
     <type 'int'>

> So it seems to be a parser-problem, 
To the extent it _is_ a problem, it is a lexer problem.  However,
"In the face of ambiguity, refuse to guess."

-- Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-Dev mailing list