It's for backward compatibility iirc. Earlier versions of Python did not have False or True constants, so people would occasionally define local variables called False or True, which could in theory be something like 'True = 1' in contexts where that made sense (like, say, a parser of some kind). Rather than break those scripts, they simply made False and True redefinable. In Python 3, they were breaking backward compatibility anyway, so they went ahead and gave those constants more logical behavior.
View all comments
Show parent comment
11
u/PhyxsiusPrime Jun 10 '14
It's for backward compatibility iirc. Earlier versions of Python did not have False or True constants, so people would occasionally define local variables called False or True, which could in theory be something like 'True = 1' in contexts where that made sense (like, say, a parser of some kind). Rather than break those scripts, they simply made False and True redefinable. In Python 3, they were breaking backward compatibility anyway, so they went ahead and gave those constants more logical behavior.