mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
#20103: Rewrite description of itertools.accumulate().
Patch by Christian Hudon.
This commit is contained in:
parent
42a17fa4fd
commit
15b04eb429
1 changed files with 9 additions and 4 deletions
|
@ -87,10 +87,15 @@ loops that truncate the stream.
|
|||
|
||||
.. function:: accumulate(iterable[, func])
|
||||
|
||||
Make an iterator that returns accumulated sums. Elements may be any addable
|
||||
type including :class:`~decimal.Decimal` or :class:`~fractions.Fraction`.
|
||||
If the optional *func* argument is supplied, it should be a function of two
|
||||
arguments and it will be used instead of addition.
|
||||
Make an iterator that returns accumulated sums, or accumulated
|
||||
results of other binary functions (specified via the optional
|
||||
*func* argument). If *func* is supplied, it should be a function
|
||||
of two arguments. Elements of the input *iterable* may be any type
|
||||
that can be accepted as arguments to *func*. (For example, with
|
||||
the default operation of addition, elements may be any addable
|
||||
type including :class:`~decimal.Decimal` or
|
||||
:class:`~fractions.Fraction`.) If the input iterable is empty, the
|
||||
output iterable will also be empty.
|
||||
|
||||
Equivalent to::
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue