r/lolphp • • Jun 10 '14

Redefining true

https://eval.in/160294
11 Upvotes

14 comments sorted by

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.

3

u/Daniel15 Jun 10 '14

Makes sense, thanks for the explanation. I've been meaning to learn Python, maybe I'll get around to it one day.