mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
Reverse argument order for nsmallest() and nlargest().
Reads better when the iterable is a generator expression.
This commit is contained in:
parent
969297f488
commit
aefde435ef
4 changed files with 9 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue