diff options
| author | Andrew Kuchling <amk@amk.ca> | 2014-04-16 02:28:40 (GMT) |
|---|---|---|
| committer | Andrew Kuchling <amk@amk.ca> | 2014-04-16 02:28:40 (GMT) |
| commit | 15b04eb42902f84fa3e35387b0c7c3391a204f65 (patch) | |
| tree | c8517b467ab2f12a0e156975411f88ad83aa2058 | |
| parent | 42a17fa4fde35f214b18f4cd0f0c69e1117c4b8a (diff) | |
| download | cpython-15b04eb42902f84fa3e35387b0c7c3391a204f65.zip cpython-15b04eb42902f84fa3e35387b0c7c3391a204f65.tar.gz cpython-15b04eb42902f84fa3e35387b0c7c3391a204f65.tar.bz2 | |
#20103: Rewrite description of itertools.accumulate().
Patch by Christian Hudon.
| -rw-r--r-- | Doc/library/itertools.rst | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index f489535..1f0bced 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -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:: |
