python-descriptors-mro
Installation
SKILL.md
Python Descriptors & MRO
Attribute access walks type(obj).__mro__ via __getattribute__. Data descriptors win over instance __dict__; non-data descriptors lose to it. super() follows the MRO of type(self), not the syntactic parent.
Attribute lookup order
| # | Source | Condition |
|---|---|---|
| 1 | Data descriptor from MRO | defines __set__ or __delete__ |
| 2 | obj.__dict__[name] |
instance variable |
| 3 | Non-data descriptor / class var | defines only __get__ |
| 4 | __getattr__ |
steps 1–3 all miss |
vars(cls)[name] returns the descriptor object itself — bypasses the protocol.