[Python-Dev] Assignment to None (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Mon Jun 9 23:15:05 CEST 2008


The question is, what is the specification for Python.

Now, that's a more interesting question than the question originally asked (which I interpreted as "why does it work the way it works").

The only indication in the specification of that feature I could find was:

http://docs.python.org/dev/library/constants.html

"Changed in version 2.4: Assignments to None are illegal and raise a SyntaxError."

Now, given that this talks about the built-in namespace, this doesn't specify that foo.None=1 should also raise a syntax error.

So the implementation apparently deviates from the specification.

In Python 3, None, True, and False are keywords, so clearly, the intended semantics is also the implemented one (and the language description for 2.x needs to be updated/clarified).

Regards, Martin



More information about the Python-Dev mailing list