I'm currently reading chapter 5.8 of Dive Into Python and Mark Pilgrim says:
There are no constants in Python. Everything can be changed if you try hard enough. This fits with one of the core principles of Python: bad behavior should be discouraged but not banned. If you really want to change the value of None, you can do it, but don't come running to me when your code is impossible to debug.
I tried this in the interpreter
None = "bad"
I get a SyntaxError: assignment to None
Just out of curiosity how do you change None?
EDIT:
Interestingly:
>>> import __builtin__
>>> __builtin__.None is None
True
>>> None
>>> None = "bad"
File "<stdin>", line 1
SyntaxError: assignment to None
>>> __builtin__.None = "bad"
File "<stdin>", line 1
SyntaxError: assignment to None
>>> setattr(__builtin__, "None", "bad")
>>> __builtin__.None
'bad'
>>> None
>>> __builtin__.None is None
False
>>> __builtin__.None = None
File "<stdin>", line 1
SyntaxError: assignment to None
Also
>>> class Abc:
... def __init__(self):
... self.None = None
...
File "<stdin>", line 3
SyntaxError: assignment to None
>>> class Abc:
... def __init__(self):
... setattr(self,'None',None)
...
>>>
So I guess 'None = ' just doesn't work in any context