Built-in constants True and False are unmodifiable in Python 3 since at least 3.3:
The false value of the bool type. Assignments to
Falseare illegal and raise aSyntaxError.The true value of the bool type. Assignments to
Trueare illegal and raise aSyntaxError.
However, in python 2.7, the code True = 0 executes without any exceptions. It seems these restrictions should have been ported to 2.x long ago, but they haven't.
The only reason I can think of is compatibility with existing code base. Do you know any case when the existing software is deliberately modifying True or False? If not, what other reasons might there be?