explicitlyi __class__ __bases__ (,links followed at instance with no __bases__ __class__ __bases__ (,links followed at class after __bases__ __class__ attr route inheritance to the class' meta tree attr though class' __class__ not followed normally attributeerror' object has no attribute 'attr __class__ [ __name__ for in __mro__[' '' ''object'[ __name__ for in __mro__[' '' ''type''object'both trees have mros and instance links __bases__ tree from __class__ __bases__ tree from __class__ if you care about metaclassesor must use code that doesstudy these examplesand then study them again in effectinheritance follows __bases__ before following single __class__normal instances have no __bases__and classes have both--whether normal or metaclass in factunderstanding this example is important to python name resolution in generalas the next section explains python' inheritance algorithmthe simple version now that we know about metaclass acquisitionwe're finally able to formalize the inheritance rules that they augment technicallyinheritance deploys two distinct but similar lookup routinesand is based on mros because __bases__ are used to construct the __mro__ ordering at class creation timeand because class' __mro__ includes itselfthe prior section' generalization is the same as the following-- first-cut definition of python' new-style inheritance algorithmto look up an explicit attribute name from an instance isearch the instancethen its classand then all its superclassesusinga the __dict__ of the instance the __dict__ of all classes on the __mro__ found at ' __class__from left to right from class csearch the classthen all its superclassesand then its metaclasses treeusinginheritance and instance