Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Modules/_functoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,28 +933,27 @@ _functools_cmp_to_key_impl(PyObject *module, PyObject *mycmp)
/* reduce (used to be a builtin) ********************************************/

/*[clinic input]
@text_signature "($module, function, iterable[, initial], /)"
_functools.reduce

function as func: object
iterable as seq: object
initial as result: object = NULL
/

Apply a function of two arguments cumulatively to an iterable, from left to right.
Apply a function of two arguments cumulatively to the items of an iterable, from left to right.

This efficiently reduces the iterable to a single value. If initial is present,
This effectively reduces the iterable to a single value. If initial is present,
it is placed before the items of the iterable in the calculation, and serves as
a default when the iterable is empty.

For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])
calculates ((((1 + 2) + 3) + 4) + 5).
calculates ((((1 + 2) + 3) + 4) + 5).")
[clinic start generated code]*/

static PyObject *
_functools_reduce_impl(PyObject *module, PyObject *func, PyObject *seq,
PyObject *result)
/*[clinic end generated code: output=30d898fe1267c79d input=d85ca22bf7ee578b]*/
/*[clinic end generated code: output=30d898fe1267c79d input=cadc408bded707d1]*/
{
PyObject *args, *it;

Expand Down
10 changes: 5 additions & 5 deletions Modules/clinic/_functoolsmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading