diff options
author | Raymond Hettinger <python@rcn.com> | 2005-03-11 06:46:45 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-03-11 06:46:45 (GMT) |
commit | a1a992c0a0003db10187696f6331b3200eb6f276 (patch) | |
tree | 5897d86492056f1ed505ccb5e3e6171f92a9755c | |
parent | 01668a1ab93baacd3c68f8b0b3b0ca6d43f0f444 (diff) | |
download | cpython-a1a992c0a0003db10187696f6331b3200eb6f276.zip cpython-a1a992c0a0003db10187696f6331b3200eb6f276.tar.gz cpython-a1a992c0a0003db10187696f6331b3200eb6f276.tar.bz2 |
Apply itemgetter() instead of lambda.
-rw-r--r-- | Lib/inspect.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 03347b9..dd89932 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -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: |