diff options
author | Pauli Virtanen <pav@iki.fi> | 2010-02-21 02:48:19 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2010-02-21 02:48:19 +0000 |
commit | 0a67e86f49a0dee8d39f94dd29947311d5491a29 (patch) | |
tree | 6394fbe4cbb41aa2f9c0bbb788c38b0c6769babd /numpy/lib/utils.py | |
parent | 6c990fbdd58e969d179e3d721d85c9f0ea3a6005 (diff) | |
download | numpy-0a67e86f49a0dee8d39f94dd29947311d5491a29.tar.gz |
3K: lib: fix sort(key=) issue
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r-- | numpy/lib/utils.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 1248c7d05..c406ecd29 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -791,11 +791,9 @@ def lookfor(what, module=None, import_modules=True, regenerate=False, 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)) |