summaryrefslogtreecommitdiffstats
path: root/Lib/difflib.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-06-15 23:53:35 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-06-15 23:53:35 (GMT)
commitaefde435efb8e99c74ad147e1a1db76fe5de61aa (patch)
treed32a79e48b1b6df8c6c4a5b84ba79902220bda9a /Lib/difflib.py
parent969297f488f314833e8ed591123deff7bd154cbd (diff)
downloadcpython-aefde435efb8e99c74ad147e1a1db76fe5de61aa.zip
cpython-aefde435efb8e99c74ad147e1a1db76fe5de61aa.tar.gz
cpython-aefde435efb8e99c74ad147e1a1db76fe5de61aa.tar.bz2
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 85a1c9c..529c786 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]