Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 4/4
- Variables
- Trying to reference a variable you haven't assigned to causes an error.
- You can use the del statement to remove a variable, which means the reference from the name to the value is deleted, and trying to use the variable causes an error. Deleted variables can be reassigned to later as normal.
- >>> foo = "a string"
- >>> foo
- 'a string'
- >>> bar
- NameError: name 'bar' is not defined
- >>> del foo
- >>> foo
- NameError: name 'foo' is not defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement