summaryrefslogtreecommitdiff
path: root/Lib/heapq.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-11-29 05:54:48 +0000
committerRaymond Hettinger <python@rcn.com>2004-11-29 05:54:48 +0000
commite1defa4175426594be53c1bc6c3d2f02a0952bae (patch)
tree31663cadc4ebc6d93bf0b7b8983bc4fa8bc19635 /Lib/heapq.py
parentf4c7c402d4944c3e1ff1a83925d5e11549ff4e36 (diff)
downloadcpython-git-e1defa4175426594be53c1bc6c3d2f02a0952bae.tar.gz
Fix argument order in pure python version of nsmallest() and nlargest().
Diffstat (limited to 'Lib/heapq.py')
-rw-r--r--Lib/heapq.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/heapq.py b/Lib/heapq.py
index 14a00dc04b..b4ebb91f14 100644
--- a/Lib/heapq.py
+++ b/Lib/heapq.py
@@ -175,7 +175,7 @@ def heapify(x):
for i in reversed(xrange(n//2)):
_siftup(x, i)
-def nlargest(iterable, n):
+def nlargest(n, iterable):
"""Find the n largest elements in a dataset.
Equivalent to: sorted(iterable, reverse=True)[:n]
@@ -195,7 +195,7 @@ def nlargest(iterable, n):
result.sort(reverse=True)
return result
-def nsmallest(iterable, n):
+def nsmallest(n, iterable):
"""Find the n smallest elements in a dataset.
Equivalent to: sorted(iterable)[:n]