<instance of subaddress unders__class____delattr____dict____dir____doc____eq____format____ge____getattribute____gt____hash____init____le____lt____module____ne____new____qualname____reduce____reduce_ex____repr____setattr____sizeof____str____subclasshook____weakref__ others_listinherited__attrnames=<bound method sub __attrnames of <testmixin tester < data =spam data =eggs data = hamsub object at spamsub object at display format is an open-ended problem ( python' standard pprint "pretty printermodule may offer options here too)so we'll leave further polishing as suggested exercise the tree lister of the next section may be more useful in any event looping in __repr__one caution here--now that we're displaying inherited methods toowe have to use __str__ instead of __repr__ to overload printing with __repr__this code will fall into recursive loops --displaying the value of method triggers the __repr__ of the method' classin order to display the class that isif the lister' __repr__ tries to display methoddisplaying the method' class will trigger the lister' __repr__ again subtlebut truechange __str__ to __repr__ here to see this for yourself if you must use __repr__ in such contextyou can avoid the loops by using isinstance to compare the type of attribute values against types methodtype in the standard libraryto know which items to skip listing attributes per object in class trees let' code one last extension as it isour latest lister includes inherited namesbut doesn' give any sort of designation of the classes from which the names are acquired as we saw in the classtree py example near the end of thoughit' straightforward to climb class inheritance trees in code the following mix-in classcoded in the file listtree pymakes use of this same technique to display attributes grouped by the classes they live in--it sketches the full physical class treedisplaying attributes attached to each object along the way the reader must still infer attribute inheritancebut this gives substantially more detail than simple flat list#!python file listtree py ( xclass listtree""mix-in that returns an __str__ trace of the entire class tree and all designing with classes