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/2004-November/049932.html below:

[Python-Dev] Int literals and method calls

[Python-Dev] Int literals and method calls"Martin v. Löwis" martin at v.loewis.de
Mon Nov 15 21:58:55 CET 2004
Michael Walter wrote:
> I think it's inconsistent because it works for "list literals" but not
> for "integer literals". What do I miss?

That tokenization works consistently, using the "maximum match"
strategy.

If you meant to parse

1.__class__

as "<integer 1>" "." "<identifier __class__>", not as "<float 1.0>"
"<identifier __class_>", then, for consistency, you should also parse
the second line of

   s = 100
   prints

as "<keyword print>" "<identifier s>", not as "<identifier prints>".
Since the latter is certainly undesirable, the former must be
followed for consistency.

You easily derive the rule "a space is necessary between keyword
and identifier" from the second example; you should, for consistency,
also derive the rule "a space is necessary between an integer
literal and a dot".

As for "list literals": The Python grammar calls them "displays",
not "literals", as they don't (necessarily) denote a literal value,
e.g. in [1,2,x,y+5].

Regards,
Martin
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