In Python 2, True
, False
and None
are built-in constants. Which means it's possible to reassign them.
True, False = False, True
True # False
False # True
You can't do this with None
since Python 2.4.
None = None # SyntaxError: cannot assign to None
In Python 3, True
, False
, and None
are now keywords.
True, False = False, True # SyntaxError: can't assign to keyword
None = None # SyntaxError: can't assign to keyword