Are Python's reserved words reserved in places they dont need to be?

metaperl metaperl at gmail.com
Tue Sep 12 19:38:26 EDT 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...
>
> Take solace in the fact that you've been immediately notifed of the
> error while its fix: renaming pass to passwd is trivial ...

The error message is not very explicit - "class is a reserved word"
will make far more sense to a new programmer than SyntaxError.
Especially since the expression is rather innocent looking and
correct-looking.




More information about the Python-list mailing list