"as" keyword woes

Paul Boddie paul at boddie.org.uk
Tue Dec 9 14:48:29 CET 2008

On 9 Des, 14:24, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> That is not what Guido said. What he actually said was:
> "That's possible with sufficiently powerful parser technology, but
> that's not how the Python parser (and most parsers, in my experience)
> treat reserved words."

I accept that many parsers are operating on predetermined tokens where
keywords will already have been identified as such, regardless of
their eventual syntactic context, by the time the parser gets to see
them. What I wanted to point out was that other approaches are not
exactly unheard of or particularly rare. Every now and again, the
language gets extended and new keywords are sought in an excruciating
process akin to a group writing exercise involving the existing
keywords. A better parsing framework would alleviate these problems.

[Car analogy cut]

> What Guido is saying is that even if he agreed with the OP he couldn't
> add that feature. He's not saying that he agrees with the OP. The Zen
> gives good reasons for believing that even if Python's parser was
> sufficiently powerful, he'd still consider the feature undesirable.

Well, I think it's more interesting to explore the boundaries of what
can be done, to debunk notions that such things aren't being done in
the mainstream, and to examine whether they could benefit usability,
than it is to defer to the Zen of Python as some kind of prescriptive,
near-religious text at every turn.


More information about the Python-list mailing list