def MRO(cls):
     "Returns the MRO of cls as a text"
     out=["MRO of %s:" % cls.__name__]
     for counter,c in enumerate(cls.__mro__):
         name=c.__name__
         bases=','.join([b.__name__ for b in c.__bases__])
         s="  %s - %s(%s)" % (counter,name,bases)
         if type(c) is not type: s+="[%s]" % type(c).__name__
         out.append(s)
     return '\n'.join(out)
Returns the MRO of cls as a text
recipes/Python/213898_Drawing_inheritance_diagrams/recipe-213898.py