special case precedence ruleclass ddef __get__(selfinstanceowner)print('__get__'def __set__(selfinstancevalue)print('__set__'class cd ( ( __get__ __set__ __dict__[' ''spami __get__ data descriptor attribute inherited data descriptor access define same name in instance namespace dict but doesn' hide data descriptor in classconverselyif this descriptor did not define __set__the name in the instance' dictionary would hide the name in its class insteadper normal inheritanceclass ddef __get__(selfinstanceowner)print('__get__'class cd ( ( __get__ __dict__[' ''spami 'spaminherited nondata descriptor access hides class names per normal inheritance rules in both casespython automatically runs the descriptor' __get__ when it' found by inheritancerather than returning the descriptor object itself--part of the attribute magic we met earlier in the book the special status afforded to data descriptorshoweveralso modifies the meaning of attribute inheritanceand thus the meaning of names in your code python' inheritance algorithmthe somewhat-more-complete version with both the data descriptor special case and general descriptor invocation factored in with class and metaclass treespython' full new-style inheritance algorithm can be stated as follows-- complex procedurewhich assumes knowledge of descriptorsmetaclassesand mrosbut is the final arbiter of attribute names nonetheless (in the followingitems are attempted in sequence either as numberedor per their left-to-right order in "orconjunctions)to look up an explicit attribute name from an instance isearch the instanceits classand its superclassesas followsa search the __dict__ of all classes on the __mro__ found at ' __class__ if data descriptor was found in step acall it and exit inheritance and instance