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

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Mon May 28 12:30:01 EDT 2001


----- Original Message -----
From: "Alex Martelli" <aleaxit at yahoo.com>
Subject: Re: Reserved words as identifiers (was Re: Long names are doom ?)


> "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?

No, you aren't confused, I am.  I didn't realize that I was inconsistent
until you pointed it out to me.

Like, oops, darn it.

> 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:-)

My statement that I don't want to be able to do

    class = 99

does not include

    spam(class = 99)

as that is a different statement.

ANYWAY, after looking at the parser I must say I am impressed, dazed,
confused, and generally no longer interested in doing this change
myself.  I'd rather try to solve a Rubik's Hypercube.








More information about the Python-list mailing list