[Numpy-svn] r8206 - trunk/numpy/lib

numpy-svn@scip... numpy-svn@scip...
Sat Feb 20 20:48:19 CST 2010


Author: ptvirtan
Date: 2010-02-20 20:48:19 -0600 (Sat, 20 Feb 2010)
New Revision: 8206

Modified:
   trunk/numpy/lib/utils.py
Log:
3K: lib: fix sort(key=) issue

Modified: trunk/numpy/lib/utils.py
===================================================================
--- trunk/numpy/lib/utils.py	2010-02-21 02:48:04 UTC (rev 8205)
+++ trunk/numpy/lib/utils.py	2010-02-21 02:48:19 UTC (rev 8206)
@@ -791,11 +791,9 @@
         r += max(-index / 100, -100)
         return r
 
-    def relevance_sort(a, b):
-        dr = relevance(b, *cache[b]) - relevance(a, *cache[a])
-        if dr != 0: return dr
-        else: return cmp(a, b)
-    found.sort(relevance_sort)
+    def relevance_value(a):
+        return relevance(a, *cache[a])
+    found.sort(key=relevance_value)
 
     # Pretty-print
     s = "Search results for '%s'" % (' '.join(whats))



More information about the Numpy-svn mailing list