__delattr__
Dunder MethodPython 2.0+Advanced
Called when deleting an attribute with del
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
Learn by Difficulty
Quick Example
python
class Example: def __delattr__(self): return "Example __delattr__" obj = Example() print(obj)
__delattr__ called when deleting an attribute with del. Implementing it lets you customize how Python interacts with your objects.
Try in PlaygroundTags
oopmagic-methodprotocolcore