Reverse argument order for nsmallest() and nlargest().

Reads better when the iterable is a generator expression.
This commit is contained in:
Raymond Hettinger 2004-06-15 23:53:35 +00:00
parent 969297f488
commit aefde435ef
4 changed files with 9 additions and 9 deletions

View file

@ -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);