unless classes derive from object strictly speakingnew-style classes also have class mro(method used in the prior example for varietyit' called at class instantiation time and its return value is list used to initialize the __mro__ attribute when the class is created (the method is available for customization in metaclassesdescribed lateryou can also select mro names if classesobject displays are too detailedthough this book usually shows the objects to remind you of their true formd mro(=list( __mro__true [cls __name__ for cls in __mro__[' '' '' '' '' ''object'however you access or display themclass mro paths might be useful to resolve confusionand in tools that must imitate python' inheritance search order the next section shows the latter role in action examplemapping attributes to inheritance sources as prime mro use casewe noted at the end of the prior that class tree climbers--such as the class tree lister mix-in we wrote there--might benefit from the mro as codedthe tree lister gave the physical locations of attributes in class tree howeverby mapping the list of inherited attributes in dir result to the linear mro sequence (or dflr order for classic classes)such tools can more directly associate attributes with the classes from which they are inherited--also useful relationship for programmers we won' recode our tree lister herebut as first major stepthe following filemapattrs pyimplements tools that can be used to associate attributes with their inheritance sourceas an added bonusits mapattrs function demonstrates how inheritance actually searches for attributes in class tree objectsthough the new-style mro is largely automated for us""file mapattrs py ( xmain toolmapattrs(maps all attributes on or inherited by an instance to the instance or class from which they are inherited assumes dir(gives all attributes of an instance to simulate inheritanceuses either the class' mro tuplewhich gives the search order for new-style classes (and all in )or recursive traversal to infer the dflr order of classic classes in also hereinheritance(gives version-neutral class orderingassorted dictionary tools using / comprehensions ""import pprint def trace(xlabel=''end='\ ') advanced class topics