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
ea7b1da1
Commit
ea7b1da1
authored
Aug 01, 2011
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12666: Clarifying changes in map for Python 3
parent
1b203741
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
Doc/whatsnew/3.0.rst
Doc/whatsnew/3.0.rst
+9
-1
No files found.
Doc/whatsnew/3.0.rst
View file @
ea7b1da1
...
...
@@ -154,7 +154,9 @@ Some well-known APIs no longer return lists:
:meth:`dict.itervalues` methods are no longer supported.
* :func:`map` and :func:`filter` return iterators. If you really need
a list, a quick fix is e.g. ``list(map(...))``, but a better fix is
a list and the input sequences are all of equal length, a quick
fix is to wrap :func:`map` in :func:`list`, e.g. ``list(map(...))``,
but a better fix is
often to use a list comprehension (especially when the original code
uses :keyword:`lambda`), or rewriting the code so it doesn't need a
list at all. Particularly tricky is :func:`map` invoked for the
...
...
@@ -162,6 +164,12 @@ Some well-known APIs no longer return lists:
regular :keyword:`for` loop (since creating a list would just be
wasteful).
If the input sequences are not of equal length, :func:`map` will
stop at the termination of the shortest of the sequences. For full
compatibility with `map` from Python 2.x, also wrap the sequences in
:func:`itertools.zip_longest`, e.g. ``map(func, *sequences)`` becomes
``list(map(func, itertools.zip_longest(*sequences)))``.
* :func:`range` now behaves like :func:`xrange` used to behave, except
it works with values of arbitrary size. The latter no longer
exists.
...
...
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