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

metaperl metaperl at gmail.com
Tue Sep 12 10:43:19 EDT 2006


  -->  python -i
>>> class = "algebra"
  File "<stdin>", line 1
    class = "algebra"
          ^
SyntaxError: invalid syntax
>>>


Why isn' t the parser smart enough to see that class followed by an
identifier is used for class definition but class followed by equals is
a simple assignment?

Also, I had a bug where I tried to set the attributes "user" and "pass"
in an object but "pass" would not work because it is a reserved word.
Again pass should be reserved in certain contexts but not others.

Is Python 3k going to fix this sort of thing?




More information about the Python-list mailing list