From aefde435efb8e99c74ad147e1a1db76fe5de61aa Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 15 Jun 2004 23:53:35 +0000 Subject: Reverse argument order for nsmallest() and nlargest(). Reads better when the iterable is a generator expression. --- Lib/difflib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/difflib.py') 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] -- cgit v1.2.1