[pypy-commit] pyrepl default: use reverse=True instead of negative comparator

RonnyPfannschmidt noreply at buildbot.pypy.org
Thu May 3 18:10:41 CEST 2012


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: 
Changeset: r188:a6cab4ec445c
Date: 2012-05-03 17:50 +0200
http://bitbucket.org/pypy/pyrepl/changeset/a6cab4ec445c/

Log:	use reverse=True instead of negative comparator

diff --git a/pyrepl/module_lister.py b/pyrepl/module_lister.py
--- a/pyrepl/module_lister.py
+++ b/pyrepl/module_lister.py
@@ -45,13 +45,7 @@
 def _make_module_list():
     import imp
     suffs = [x[0] for x in imp.get_suffixes() if x[0] != '.pyc']
-    def compare(x, y):
-        c = -cmp(len(x), len(y))
-        if c:
-            return c
-        else:
-            return -cmp(x, y)
-    suffs.sort(compare)
+    suffs.sort(reverse=True)
     _packages[''] = list(sys.builtin_module_names)
     for dir in sys.path:
         if dir == '':


More information about the pypy-commit mailing list