summaryrefslogtreecommitdiffstats
path: root/Modules
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 /Modules
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 'Modules')
-rw-r--r--Modules/_heapqmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_heapqmodule.c b/Modules/_heapqmodule.c
index 8074bb1..21df796 100644
--- a/Modules/_heapqmodule.c
+++ b/Modules/_heapqmodule.c
@@ -222,7 +222,7 @@ nlargest(PyObject *self, PyObject *args)
PyObject *heap=NULL, *elem, *iterable, *sol, *it, *oldelem;
int i, n;
- if (!PyArg_ParseTuple(args, "Oi:nlargest", &iterable, &n))
+ if (!PyArg_ParseTuple(args, "iO:nlargest", &n, &iterable))
return NULL;
it = PyObject_GetIter(iterable);
@@ -381,7 +381,7 @@ nsmallest(PyObject *self, PyObject *args)
PyObject *heap=NULL, *elem, *iterable, *los, *it, *oldelem;
int i, n;
- if (!PyArg_ParseTuple(args, "Oi:nsmallest", &iterable, &n))
+ if (!PyArg_ParseTuple(args, "iO:nsmallest", &n, &iterable))
return NULL;
it = PyObject_GetIter(iterable);