How do I undo True = False in python interactive mode? [duplicate]

So I tried the "evil" thing Ned Deily mentioned in his answer here. Now I have that the type True is now always False. How would I reverse this within the interactive window?

Thing to not do:

True = False

Since True has now been completely overridden with False, there doesn't seem to be an obvious way to back-track. Is there a module that True comes from that I can do something like:

True = <'module'>.True

Solution 1:

You can simply del your custom name to set it back to the default:

>>> True = False
>>> True
False
>>> del True
>>> True
True
>>>

Solution 2:

This works:

>>> True = False
>>> True
False
>>> True = not False
>>> True
True

but fails if False has been fiddled with as well. Therefore this is better:

>>> True = not None

as None cannot be reassigned.

These also evaluate to True regardless of whether True has been reassigned to False, 5, 'foo', None, etc:

>>> True = True == True   # fails if True = float('nan')
>>> True = True is True
>>> True = not True or not not True
>>> True = not not True if True else not True
>>> True = not 0