Deletes the named attribute of an object.
delattr (object, name)
- object
- Required. The name of the object which attribute will be deleted. Must be an object.
- name
- Required. The name of the attribute to delete. Must be a string.
#TODO
#TODO
See also setattr().
>>> class Foo:
... def __init__(self, x=0):
... self.x = x
...
>>> f = Foo(10)
>>> f.x
10
>>> delattr(f, 'x')
>>> f.x
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
AttributeError: Foo instance has no attribute 'x'#TODO