2 ms·
Python, to its credit, has been making changes of that level. First, True and False were just the integers 1 and 0. Then they were given special values that nu
by koenigdavidmj 13y ago
Python, to its credit, has been making changes of that level.
First, True and False were just the integers 1 and 0. Then they were given special values that numerically evaluated to 1 and 0, but __str__ now emitted 'True' or 'False'. They were still global variables, though, so they could be reassigned ('True, False = False, True') and cost a dictionary lookup to use. Finally, with Python 3, they (along with None) were made keywords so that such shenanigans could be stopped.