summaryrefslogtreecommitdiff
path: root/Lib/difflib.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-06-15 23:53:35 +0000
committerRaymond Hettinger <python@rcn.com>2004-06-15 23:53:35 +0000
commitf5ee703d7172d7d3539f06e6e647ea517b0fa140 (patch)
tree7fed1fb12c45e8e092b3d7b99507f4392d1325ff /Lib/difflib.py
parent1244897b76ca9a8c17e44dffce0d1253bdab1fc5 (diff)
downloadcpython-f5ee703d7172d7d3539f06e6e647ea517b0fa140.tar.gz
Reverse argument order for nsmallest() and nlargest().
Reads better when the iterable is a generator expression.
Diffstat (limited to 'Lib/difflib.py')
-rw-r--r--Lib/difflib.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/difflib.py b/Lib/difflib.py
index 85a1c9cb70..529c78638c 100644
--- a/Lib/difflib.py
+++ b/Lib/difflib.py
@@ -705,7 +705,7 @@ def get_close_matches(word, possibilities, n=3, cutoff=0.6):
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]