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
952aea2c
Commit
952aea2c
authored
Sep 04, 2007
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change docs for builtins that now return iterators.
parent
d22a8152
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
33 deletions
+39
-33
Doc/library/functions.rst
Doc/library/functions.rst
+39
-33
No files found.
Doc/library/functions.rst
View file @
952aea2c
...
@@ -406,16 +406,17 @@ available. They are listed here in alphabetical order.
...
@@ -406,16 +406,17 @@ available. They are listed here in alphabetical order.
..
function
::
filter
(
function
,
iterable
)
..
function
::
filter
(
function
,
iterable
)
Construct
a
list
from
those
elements
of
*
iterable
*
for
which
*
function
*
returns
Construct
a
n
iterator
from
those
elements
of
*
iterable
*
for
which
*
function
*
true
.
*
iterable
*
may
be
either
a
sequence
,
a
container
which
supports
returns
true
.
*
iterable
*
may
be
either
a
sequence
,
a
container
which
iteration
,
or
an
iterator
,
If
*
iterable
*
is
a
string
or
a
tuple
,
the
result
supports
iteration
,
or
an
iterator
,
If
*
iterable
*
is
a
string
or
a
tuple
,
the
also
has
that
type
;
otherwise
it
is
always
a
list
.
If
*
function
*
is
``
None
``,
result
also
has
that
type
;
otherwise
it
is
always
a
list
.
If
*
function
*
is
the
identity
function
is
assumed
,
that
is
,
all
elements
of
*
iterable
*
that
are
``
None
``,
the
identity
function
is
assumed
,
that
is
,
all
elements
of
false
are
removed
.
*
iterable
*
that
are
false
are
removed
.
Note
that
``
filter
(
function
,
iterable
)``
is
equivalent
to
``[
item
for
item
in
Note
that
``
filter
(
function
,
iterable
)``
is
equivalent
to
the
generator
iterable
if
function
(
item
)]``
if
function
is
not
``
None
``
and
``[
item
for
item
expression
``(
item
for
item
in
iterable
if
function
(
item
))``
if
function
is
in
iterable
if
item
]``
if
function
is
``
None
``.
not
``
None
``
and
``(
item
for
item
in
iterable
if
item
)``
if
function
is
``
None
``.
..
function
::
float
([
x
])
..
function
::
float
([
x
])
...
@@ -608,15 +609,19 @@ available. They are listed here in alphabetical order.
...
@@ -608,15 +609,19 @@ available. They are listed here in alphabetical order.
..
function
::
map
(
function
,
iterable
,
...)
..
function
::
map
(
function
,
iterable
,
...)
Apply
*
function
*
to
every
item
of
*
iterable
*
and
return
a
list
of
the
results
.
Return
an
iterator
that
applies
*
function
*
to
every
item
of
*
iterable
*,
If
additional
*
iterable
*
arguments
are
passed
,
*
function
*
must
take
that
many
yielding
the
results
.
If
additional
*
iterable
*
arguments
are
passed
,
arguments
and
is
applied
to
the
items
from
all
iterables
in
parallel
.
If
one
*
function
*
must
take
that
many
arguments
and
is
applied
to
the
items
from
all
iterable
is
shorter
than
another
it
is
assumed
to
be
extended
with
``
None
``
iterables
in
parallel
.
If
one
iterable
is
shorter
than
another
it
is
assumed
items
.
If
*
function
*
is
``
None
``,
the
identity
function
is
assumed
;
if
there
to
be
extended
with
``
None
``
items
.
If
*
function
*
is
``
None
``,
the
identity
are
multiple
arguments
,
:
func
:`
map
`
returns
a
list
consisting
of
tuples
function
is
assumed
;
if
there
are
multiple
arguments
,
:
func
:`
map
`
returns
a
containing
the
corresponding
items
from
all
iterables
(
a
kind
of
transpose
list
consisting
of
tuples
containing
the
corresponding
items
from
all
operation
).
The
*
iterable
*
arguments
may
be
a
sequence
or
any
iterable
object
;
iterables
(
a
kind
of
transpose
operation
).
The
*
iterable
*
arguments
may
be
a
the
result
is
always
a
list
.
sequence
or
any
iterable
object
;
the
result
is
always
a
list
.
Note
that
for
only
one
*
iterable
*
argument
,
``
map
(
function
,
iterable
)``
is
equivalent
to
the
generator
expression
``(
function
(
item
)
for
item
in
iterable
)``
if
*
function
*
is
not
``
None
``.
..
function
::
max
(
iterable
[,
args
...],
*[,
key
])
..
function
::
max
(
iterable
[,
args
...],
*[,
key
])
...
@@ -793,17 +798,18 @@ available. They are listed here in alphabetical order.
...
@@ -793,17 +798,18 @@ available. They are listed here in alphabetical order.
the same name.
the same name.
.. XXX does accept objects with __index__ too
.. function:: range([start,] stop[, step])
.. function:: range([start,] stop[, step])
This is a versatile function to create
sequence
s containing arithmetic
This is a versatile function to create
iterator
s containing arithmetic
progressions. It is most often used in :keyword:`for` loops. The arguments
progressions. It is most often used in :keyword:`for` loops. The arguments
must be
plain integers. If the *step* argument is omitted, it defaults to
must be
integers. If the *step* argument is omitted, it defaults to ``1``.
``1``.
If the *start* argument is omitted, it defaults to ``0``. The full form
If the *start* argument is omitted, it defaults to ``0``. The full form
returns a
list of plain integers ``[start, start + step, start + 2 * step,
returns a
n iterator of plain integers ``[start, start + step, start + 2 *
...]``. If *step* is positive, the last element is the largest ``start + i *
step, ...]``. If *step* is positive, the last element is the largest ``start
step`` less than *stop*; if *step* is negative, the last element is the smallest
+ i * step`` less than *stop*; if *step* is negative, the last element is the
``start + i * step`` greater than *stop*. *step* must not be zero (or else
smallest ``start + i * step`` greater than *stop*. *step* must not be zero
:exc:`ValueError` is raised). Example::
(or else
:exc:`ValueError` is raised). Example::
>>> list(range(10))
>>> list(range(10))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
...
@@ -1045,13 +1051,13 @@ available. They are listed here in alphabetical order.
...
@@ -1045,13 +1051,13 @@ available. They are listed here in alphabetical order.
..
function
::
zip
([
iterable
,
...])
..
function
::
zip
([
iterable
,
...])
This
function
returns
a
list
of
tuples
,
where
the
*
i
*-
th
tuple
contains
the
This
function
returns
a
n
iterator
of
tuples
,
where
the
*
i
*-
th
tuple
contains
*
i
*-
th
element
from
each
of
the
argument
sequences
or
iterables
.
The
returned
the
*
i
*-
th
element
from
each
of
the
argument
sequences
or
iterables
.
The
list
is
truncated
in
length
to
the
length
of
the
shortest
argument
sequence
.
iterator
stops
when
the
shortest
argument
sequence
is
exhausted
.
When
there
When
there
are
multiple
arguments
which
are
all
of
the
same
length
,
:
func
:`
zip
`
are
multiple
arguments
which
are
all
of
the
same
length
,
:
func
:`
zip
`
is
is
similar
to
:
func
:`
map
`
with
an
initial
argument
of
``
None
``.
With
a
single
similar
to
:
func
:`
map
`
with
an
initial
argument
of
``
None
``.
With
a
single
sequence
argument
,
it
returns
a
list
of
1
-
tuples
.
With
no
arguments
,
it
returns
sequence
argument
,
it
returns
a
n
iterator
of
1
-
tuples
.
With
no
arguments
,
it
an
empty
list
.
returns
an
empty
iterator
.
..
%
---------------------------------------------------------------------------
..
%
---------------------------------------------------------------------------
...
...
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