Warren DeLano wrote:

As someone somewhat knowledgable of how parsers work, I do not
understand why a method/attribute name "object_name.as(...)" must
necessarily conflict with a standalone keyword " as ".  It seems to me
that it should be possible to unambiguously separate the two without
ambiguity or undue complication of the parser.

The lexer, which preceeds the parser, has separate KEYWORD and IDENTIFIER categories. For example, 'if a ...' is lexed as (KEYWORD, 'if'), (IDENTIFIER, 'a'), ... . Leaving 'as' as an identifier identified by the parser as a contextual keyword in import statements was a kludge. When 'as' was reused in "with <expr> as <target>" in 2.5 (with __future__ import), it was planned and announced that *both* 'with' and 'as' would become full-time keywords in 2.6, just as 'yield' did in 2.3 after its introduction (with required __future__) in 2.2.

Making 'yield' a keyword of course impacted people who used the word in financial calculations, but they adjusted.

> So, assuming I now wish to propose a corrective PEP

Working with people trying to improve threading would be more productive.

Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to