mirror of
https://github.com/python/cpython.git
synced 2025-01-27 11:33:55 +08:00
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.
This commit is contained in:
parent
729d47db09
commit
41f89a4f3d
@ -557,7 +557,8 @@ def getsource(object):
|
||||
def walktree(classes, children, parent):
|
||||
"""Recursive helper function for getclasstree()."""
|
||||
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:
|
||||
results.append((c, c.__bases__))
|
||||
if c in children:
|
||||
|
Loading…
Reference in New Issue
Block a user