[Python-checkins] cpython: #20103: Rewrite description of itertools.accumulate().

andrew.kuchling python-checkins at python.org
Wed Apr 16 04:29:16 CEST 2014


http://hg.python.org/cpython/rev/9e1d2150fff2
changeset:   90349:9e1d2150fff2
user:        Andrew Kuchling <amk at amk.ca>
date:        Tue Apr 15 22:28:40 2014 -0400
summary:
  #20103: Rewrite description of itertools.accumulate().

Patch by Christian Hudon.

files:
  Doc/library/itertools.rst |  13 +++++++++----
  1 files changed, 9 insertions(+), 4 deletions(-)


diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -87,10 +87,15 @@
 
 .. 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::
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list