elsecall nondata descriptor or return value found in step from class csearch the classits superclassesand its metaclasses treeas followsa search the __dict__ of all metaclasses on the __mro__ found at ' __class__ if data descriptor was found in step acall it and exit elsecall descriptor or return value in the __dict__ of class on ' own __mro__ elsecall nondata descriptor or return value found in step in both rule and built-in operations essentially use just step sources (see aheadnote here again that this applies to normalexplicit attribute fetch only the implicit lookup of method names for built-ins doesn' follow these rulesand essentially uses just step sources in both casesas the next section will demonstrate on top of all thismethod __getattr__ may be run if defined when an attribute is not foundand method __getattribute__ may be run for every attribute fetchthough they are special-case extensions to the name lookup model see for more on these tools and descriptors assignment inheritance also note that the prior section defines inheritance in terms of attribute reference (lookup)but parts of it apply to attribute assignment as well as we've learnedassignment normally changes attributes in the subject object itselfbut inheritance is also invoked on assignment to test first for some of ' attribute management toolsincluding descriptors and properties when presentsuch tools intercept attribute assignmentand may route it arbitrarily for examplewhen an attribute assignment is run for new-style classesa data descriptor with __set__ method is acquired from class by inheritance using the mroand has precedence over the normal storage model in terms of the prior section' ruleswhen applied to an instancesuch assignments essentially follow steps through of rule searching the instance' class treethough step calls __set__ instead of __get__and step stops and stores in the instance instead of attempting fetch when applied to classsuch assignments run the same procedure on the class' metaclass treeroughly the same as rule but step stops and stores in the class because descriptors are also the basis for other advanced attribute tools such as properties and slotsthis inheritance pre-check on assignment is utilized in multiple contexts the net effect is that descriptors are treated as an inheritance special case in newstyle classesfor both reference and assignment metaclasses