__delete__

Dunder MethodPython 2.0+Expert

Descriptor protocol: called to delete an attribute on the owner class

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
class Example:
    def __delete__(self):
        return "Example __delete__"

obj = Example()
print(obj)

__delete__ descriptor protocol: called to delete an attribute on the owner class. Implementing it lets you customize how Python interacts with your objects.

Try in Playground

Tags

oopmagic-methodprotocolcore