Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1be2ac9c
Commit
1be2ac9c
authored
Dec 20, 2006
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bug #1619674] Make sum() use the term iterable, not sequence
parent
eca4c312
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Doc/lib/libfuncs.tex
Doc/lib/libfuncs.tex
+5
-5
No files found.
Doc/lib/libfuncs.tex
View file @
1be2ac9c
...
...
@@ -1087,11 +1087,11 @@ class C:
string,
\code
{
''
}
.
\end{funcdesc}
\begin{funcdesc}
{
sum
}{
sequenc
e
\optional
{
, start
}}
Sums
\var
{
start
}
and the items of a
\var
{
sequence
}
,
from left to
right
,
and returns the total.
\var
{
start
}
defaults to
\code
{
0
}
.
The
\var
{
sequenc
e
}
's items are normally numbers, and are not allowed
to be strings. The fast, correct way to concatenate sequence of
\begin{funcdesc}
{
sum
}{
iterabl
e
\optional
{
, start
}}
Sums
\var
{
start
}
and the items of a
n
\var
{
iterable
}
from left to
right and returns the total.
\var
{
start
}
defaults to
\code
{
0
}
.
The
\var
{
iterabl
e
}
's items are normally numbers, and are not allowed
to be strings. The fast, correct way to concatenate
a
sequence of
strings is by calling
\code
{
''.join(
\var
{
sequence
}
)
}
.
Note that
\code
{
sum(range(
\var
{
n
}
),
\var
{
m
}
)
}
is equivalent to
\code
{
reduce(operator.add, range(
\var
{
n
}
),
\var
{
m
}
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment