- #+title: Python/Descriptors
- Described in the datamodel: https://docs.python.org/3/reference/datamodel.html
- Applied when instance of class containing the method == descriptor, appears in an owner class
__get__
get value of attribute for instance or class
__set__
set value of instance (data descriptor)
__delete__
delete attribute on instance
- "Descriptor" is an object attribute with binding behavior
a.x
= =x.__get__(a)
= =type(a).__dict__['x'].__get__(a, type(a))
- etc.
- No get means it returns the object itself
@staticmethod
& @classmethod
are non-data descriptors
- Non-data descriptors can be overridden