]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
SF bug #821701: reduce docs neglect a very important piece of information.
authorRaymond Hettinger <python@rcn.com>
Mon, 13 Oct 2003 17:54:46 +0000 (17:54 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 13 Oct 2003 17:54:46 +0000 (17:54 +0000)
Add a note showing which argument is the accumulator.

Doc/lib/libfuncs.tex

index a628dea9c8a72347cf095bbf445f9776989a432f..c694e8321e79176f4f708a789cda0ce71058323a 100644 (file)
@@ -816,7 +816,9 @@ class C(object):
   Apply \var{function} of two arguments cumulatively to the items of
   \var{sequence}, from left to right, so as to reduce the sequence to
   a single value.  For example, \code{reduce(lambda x, y: x+y, [1, 2,
-  3, 4, 5])} calculates \code{((((1+2)+3)+4)+5)}.  If the optional
+  3, 4, 5])} calculates \code{((((1+2)+3)+4)+5)}.  The left argument,
+  \var{x}, is the accumulated value and the right argument, \var{y},
+  is the update value from the \var{sequence}.  If the optional
   \var{initializer} is present, it is placed before the items of the
   sequence in the calculation, and serves as a default when the
   sequence is empty.  If \var{initializer} is not given and