Reserved words as identifiers (was Re: Long names are doom ?)

Alex Martelli aleaxit at yahoo.com
Mon May 28 13:46:11 CEST 2001


"Chris Gonnerman" <chris.gonnerman at newcenturycomputers.net> wrote in message
news:mailman.990997662.29840.python-list at python.org...
    ...
> specifically, reserved words which would cause a SyntaxError to be
> raised would be rechecked as identifiers.  This shouldn't take much
> work on the part of the parser IMHO although it still looks a bit like
> a Rubik's Cube to me...
>
> In other words, I DON'T want to be able to do this:
>
>     class = 99   # BAD

I don't understand the equivalence between the first paragraph
and the "in other words" second one.  This example IS exactly
one of "reserved words which would cause a SyntaxError" -- what
in the previous paragraph you suggest "would be rechecked as
identifiers".  But here you say you DON'T want to be able to
do this.  So, I guess I'm confused.  How would the SyntaxError's
you DO want to cause "re-checking" be distinguished from those
you don't?

The 'integrate with alien frameworks' advantage for un-reserving
of keywords does require the ability to use class=99, by the
way, although not (necessarily) as an assignment, but rather
as named-argument passing.  A syntax convenience to avoid such
contortions as funz(*{'class':99}), of course, just as other
required "un-reservings" avoid lesser contortions of the
setattr(x,'class',99) and getattr(x,'class') persuasions:-)


Alex






More information about the Python-list mailing list