A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-January/075882.html below:

[Python-Dev] function call syntax oddity

[Python-Dev] function call syntax oddity [Python-Dev] function call syntax oddityPaul 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 "<stdin>", 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4