[Python-checkins] python/dist/src/Lib heapq.py,1.26,1.27

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Mon Nov 29 06:54:51 CET 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10916

Modified Files:
	heapq.py 
Log Message:
Fix argument order in pure python version of nsmallest() and nlargest().



Index: heapq.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- heapq.py	6 Sep 2004 07:04:09 -0000	1.26
+++ heapq.py	29 Nov 2004 05:54:47 -0000	1.27
@@ -175,7 +175,7 @@
     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 @@
     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]



More information about the Python-checkins mailing list