summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libfuncs.tex8
-rw-r--r--Doc/tut/tut.tex5
2 files changed, 12 insertions, 1 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index 323a516..50f22f8 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -897,6 +897,14 @@ class C:
\versionadded{2.2}
\end{funcdesc}
+\begin{funcdesc}{sum}{sequence\optional{start=0}}
+ Sums up the items of a \var{sequence}, from left to right, and returns
+ the total. The \var{sequence}'s items are normally numbers, and are
+ not allowed to be strings. The fast, correct way to join up a
+ sequence of strings is by calling \code{''.join(\var{sequence})}.
+ \versionadded{2.3}
+\end{funcdesc}
+
\begin{funcdesc}{super}{type\optional{object-or-type}}
Return the superclass of \var{type}. If the second argument is omitted
the super object returned is unbound. If the second argument is an
diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex
index 71d3f60..b227576 100644
--- a/Doc/tut/tut.tex
+++ b/Doc/tut/tut.tex
@@ -1819,6 +1819,9 @@ item, then to the result and the next item, and so on. For example,
0
\end{verbatim}
+Don't use this example's definition of \code{sum}: since summing numbers
+is such a common need, a built-in function \code{sum(\var{sequence})} is
+already provided, and works exactly like this\versionadded{2,3}.
\subsection{List Comprehensions}
@@ -2502,7 +2505,7 @@ standard module \module{__builtin__}\refbimodindex{__builtin__}:
'len', 'license', 'list', 'locals', 'long', 'map', 'max', 'min',
'object', 'oct', 'open', 'ord', 'pow', 'property', 'quit',
'range', 'raw_input', 'reduce', 'reload', 'repr', 'round',
- 'setattr', 'slice', 'staticmethod', 'str', 'string', 'super',
+ 'setattr', 'slice', 'staticmethod', 'str', 'string', 'sum', 'super',
'tuple', 'type', 'unichr', 'unicode', 'vars', 'xrange', 'zip']
\end{verbatim}