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
96c4de96
Commit
96c4de96
authored
Nov 14, 2014
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes #22868: make example less ambiguous.
parent
01bd3c12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Doc/tutorial/datastructures.rst
Doc/tutorial/datastructures.rst
+3
-3
No files found.
Doc/tutorial/datastructures.rst
View file @
96c4de96
...
...
@@ -181,12 +181,12 @@ There are three built-in functions that are very useful when used with lists:
the sequence for which ``function(item)`` is true. If *sequence* is a
:class:`string` or :class:`tuple`, the result will be of the same type;
otherwise, it is always a :class:`list`. For example, to compute a sequence of
numbers
not
divisible by 2 or 3::
numbers divisible by 2 or 3::
>>> def f(x): return x %
2 != 0 and x % 3 !
= 0
>>> def f(x): return x %
3 == 0 or x % 5 =
= 0
...
>>> filter(f, range(2, 25))
[
5, 7, 11, 13, 17, 19, 23
]
[
3, 5, 6, 9, 10, 12, 15, 18, 20, 21, 24
]
``map(function, sequence)`` calls ``function(item)`` for each of the sequence's
items and returns a list of the return values. For example, to compute some
...
...
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