Skip to content

Instantly share code, notes, and snippets.

@nvie
Forked from bobthecow/untitled.txt
Created October 18, 2010 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvie/632828 to your computer and use it in GitHub Desktop.
Save nvie/632828 to your computer and use it in GitHub Desktop.
>>>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