Skip to content

Instantly share code, notes, and snippets.

@thiago-vieira
Created November 23, 2012 20:18
Show Gist options
  • Save thiago-vieira/4137112 to your computer and use it in GitHub Desktop.
Save thiago-vieira/4137112 to your computer and use it in GitHub Desktop.
del objects in python
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