-
-
Save nvie/632828 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>>True,False=False,True | |
>>>False | |
True | |
>>>1==2 | |
False | |
>>>(1==2)==True | |
True | |
>>> # This shows how setting True/False is nothing more than a simple (yet scary!) | |
>>> # variable assignment in the local scope: | |
>>> True, False = 1, 2 | |
>>> type(True) | |
<type 'int'> | |
>>> # Deleting the local variable reveals the built-in symbol True | |
>>> del True | |
>>> type(True) | |
<type 'bool'> | |
>>> # You can't delete the built-in True | |
>>> del True | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
NameError: name 'True' is not defined | |
>>> # In contrast, for other literals, this raises a SyntaxError | |
>>> 4 = 1 | |
File "<stdin>", line 1 | |
SyntaxError: can't assign to literal | |
>>> None = 1 | |
File "<stdin>", line 1 | |
SyntaxError: assignment to None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment