Commit 41f89a4f authored by Skip Montanaro's avatar Skip Montanaro

Sort classes by fully qualified name. In the common case where you are

displaying a set of classes from one module it doesn't matter, but if you
are displaying a large class tree from multiple modules it improves the
display to sort by module.name.
parent 729d47db
...@@ -557,7 +557,8 @@ def getsource(object): ...@@ -557,7 +557,8 @@ def getsource(object):
def walktree(classes, children, parent): def walktree(classes, children, parent):
"""Recursive helper function for getclasstree().""" """Recursive helper function for getclasstree()."""
results = [] results = []
classes.sort(key=attrgetter('__name__')) classes.sort(lambda a, b: cmp("%s.%s" % (a.__module__, a.__name__),
"%s.%s" % (b.__module__, b.__name__)))
for c in classes: for c in classes:
results.append((c, c.__bases__)) results.append((c, c.__bases__))
if c in children: if c in children:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment