[Python-Dev] function call syntax oddity (original) (raw)

Paul Moore p.f.moore at gmail.com
Fri Jan 4 22:32:44 CET 2008


On 04/01/2008, Joseph Armbruster <josepharmbruster at gmail.com> wrote:

Cool I suppose, except here's an odd man out:

>>> 1.str() File "", line 1 1.str() ^ SyntaxError: invalid syntax

It's parsed a floating point number - "1." - followed by the keyword "str". That's not valid.

>>> 1 .str() '1'

This one is a number "1" followed by the operator "." followed by "str".

The lexer reads the longest valid token each time. Paul.



More information about the Python-Dev mailing list