Created
November 23, 2012 20:18
-
-
Save thiago-vieira/4137112 to your computer and use it in GitHub Desktop.
del objects in python
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
class Class: | |
def __init__(self): | |
self.attribute = "value" | |
instance = Class() | |
print(instance.attribute) # "value" | |
del instance.attribute | |
print(instance.attribute) # ops, AttributeError | |
del Class | |
new_instance = Class() # ops, NameError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment