Mercurial > cpython-lru_cache-weakref
diff Lib/difflib.py @ 32357:a46bde9e0c74 legacy-trunk
Reverse argument order for nsmallest() and nlargest().
Reads better when the iterable is a generator expression.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Tue, 15 Jun 2004 23:53:35 +0000 |
| parents | 408a40e65247 |
| children | 5546c7ae24f7 |
line wrap: on
line diff
--- a/Lib/difflib.py Tue Jun 15 18:49:58 2004 +0000 +++ b/Lib/difflib.py Tue Jun 15 23:53:35 2004 +0000 @@ -705,7 +705,7 @@ result.append((s.ratio(), x)) # Move the best scorers to head of list - result = heapq.nlargest(result, n) + result = heapq.nlargest(n, result) # Strip scores for the best n matches return [x for score, x in result]
