[Python-checkins] python/dist/src/Lib inspect.py,1.55,1.56
montanaro at users.sourceforge.net
montanaro at users.sourceforge.net
Mon Sep 20 17:40:41 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29971
Modified Files:
inspect.py
Log Message:
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.
Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- inspect.py 11 Sep 2004 15:53:22 -0000 1.55
+++ inspect.py 20 Sep 2004 15:40:38 -0000 1.56
@@ -557,7 +557,8 @@
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:
More information about the Python-checkins
mailing list