From: Guido van Rossum Date: Wed, 6 Jan 1999 23:10:51 +0000 (+0000) Subject: Replace the docs for reduce with an adaptation of its docstring, which X-Git-Tag: v1.5.2b2~430 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=87e611e4416d6e56ea54b22cddb689bef2d4bebd;p=python Replace the docs for reduce with an adaptation of its docstring, which was actually clearer! --- diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index d0b52a77de..3f241017c7 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -501,14 +501,15 @@ If the \module{readline} module was loaded, then line editing and history features. \end{funcdesc} -\begin{funcdesc}{reduce}{function, list\optional{, initializer}} -Apply the binary \var{function} to the items of \var{list} so as to -reduce the list to a single value. E.g., -\code{reduce(lambda x, y: x*y, \var{list}, 1)} returns the product of -the elements of \var{list}. The optional \var{initializer} can be -thought of as being prepended to \var{list} so as to allow reduction -of an empty \var{list}. The \var{list} arguments may be any kind of -sequence. +\begin{funcdesc}{reduce}{function, sequence\optional{, initializer}} +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 \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. \end{funcdesc} \begin{funcdesc}{reload}{module}