mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[Bug #1619674] Make sum() use the term iterable, not sequence
This commit is contained in:
parent
eca4c31267
commit
1be2ac9cd6
1 changed files with 5 additions and 5 deletions
|
@ -1087,11 +1087,11 @@ class C:
|
||||||
string, \code{''}.
|
string, \code{''}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{sum}{sequence\optional{, start}}
|
\begin{funcdesc}{sum}{iterable\optional{, start}}
|
||||||
Sums \var{start} and the items of a \var{sequence}, from left to
|
Sums \var{start} and the items of an \var{iterable} from left to
|
||||||
right, and returns the total. \var{start} defaults to \code{0}.
|
right and returns the total. \var{start} defaults to \code{0}.
|
||||||
The \var{sequence}'s items are normally numbers, and are not allowed
|
The \var{iterable}'s items are normally numbers, and are not allowed
|
||||||
to be strings. The fast, correct way to concatenate sequence of
|
to be strings. The fast, correct way to concatenate a sequence of
|
||||||
strings is by calling \code{''.join(\var{sequence})}.
|
strings is by calling \code{''.join(\var{sequence})}.
|
||||||
Note that \code{sum(range(\var{n}), \var{m})} is equivalent to
|
Note that \code{sum(range(\var{n}), \var{m})} is equivalent to
|
||||||
\code{reduce(operator.add, range(\var{n}), \var{m})}
|
\code{reduce(operator.add, range(\var{n}), \var{m})}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue