]> granicus.if.org Git - python/commitdiff
Apply itemgetter() instead of lambda.
authorRaymond Hettinger <python@rcn.com>
Fri, 11 Mar 2005 06:46:45 +0000 (06:46 +0000)
committerRaymond Hettinger <python@rcn.com>
Fri, 11 Mar 2005 06:46:45 +0000 (06:46 +0000)
Lib/inspect.py

index 03347b9a33f6563bc03f21151705aeeccb7dee89..dd89932cafa4c7b5c14ce5d6d2d94f4ea411fcaf 100644 (file)
@@ -29,6 +29,7 @@ __author__ = 'Ka-Ping Yee <ping@lfw.org>'
 __date__ = '1 Jan 2001'
 
 import sys, os, types, string, re, dis, imp, tokenize, linecache
+from operator import attrgetter
 
 # ----------------------------------------------------------- type-checking
 def ismodule(object):
@@ -567,7 +568,7 @@ def getsource(object):
 def walktree(classes, children, parent):
     """Recursive helper function for getclasstree()."""
     results = []
-    classes.sort(key=lambda c: (c.__module__, c.__name__))
+    classes.sort(key=attrgetter('__module__', '__name__'))
     for c in classes:
         results.append((c, c.__bases__))
         if c in children: