Are Python's reserved words reserved in places they dont need to be?
sigzero at gmail.com
Wed Sep 13 03:05:31 CEST 2006
> Istvan Albert wrote:
> > metaperl wrote:
> > > --> python -i
> > > >>> class = "algebra"
> > > File "<stdin>", line 1
> > > class = "algebra"
> > > ^
> > > SyntaxError: invalid syntax
> > Designing a syntax to avoid all possible newbie errors is impractical
> > because as soon as you are finished with one iteration the new newbies
> > will start making different kinds of errors...
> You are missing the point: the point is that the above could be
> considered correct if the rules of Python were that an assignment
> statement takes
> IDENTIFIER '=' LVALUE
> Also "class" IDENTIFIER COLON could also be considered correct.
Yes it could but it isn't and isn't likely to be. Simply do not use
reserved words. That rule is hardly limited to Python.
More information about the Python-list