From 2095b9690fd2bab2e899b00c4a5c807671c178eb Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Wed, 17 Jul 2002 13:55:33 +0000 Subject: [PATCH] reduce(): Clarified what is returned in the case of a sequence 1 item long and initial/default value. --- Doc/lib/libfuncs.tex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index 5526dc53a7e..1aa59dc75c4 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -717,12 +717,12 @@ def my_import(name): \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. + 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. If \var{initializer} is not given and + \var{sequence} contains only one item, the first item is returned. \end{funcdesc} \begin{funcdesc}{reload}{module}