This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2to3 should treat enumerate like sorted for zip, map, filter, dict, xrange
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, jpkotta, python-dev
Priority: normal Keywords: patch

Created on 2012-11-28 23:58 by jpkotta, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
enumerate.patch jpkotta, 2012-11-28 23:57 patch review
Messages (3)
msg176590 - (view) Author: Jonathan Kotta (jpkotta) Date: 2012-11-28 23:57
enumerate() is a "consuming_call", as defined in fixer_util.py, because it takes an iterable (not necessarily a collection).  Therefore whenever we have something like enumerate(zip(...)), we don't need to replace it with enumerate(list(zip(...))) in 2to3, because enumerate doesn't care that zip no longer returns a list.

Patch attached.
msg176656 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2012-11-29 15:58
Thanks for the patch.
msg176657 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-11-29 15:58
New changeset 3c6d8461b09f by Benjamin Peterson in branch '3.2':
enumerate only requires an iterable (closes #16573)
http://hg.python.org/cpython/rev/3c6d8461b09f

New changeset 4ff17cf130eb by Benjamin Peterson in branch '3.3':
merge 3.2 (#16573)
http://hg.python.org/cpython/rev/4ff17cf130eb

New changeset 2bb604a691de by Benjamin Peterson in branch '2.7':
enumerate only requires an iterable (closes #16573)
http://hg.python.org/cpython/rev/2bb604a691de

New changeset ce3f0399ea33 by Benjamin Peterson in branch 'default':
merge 3.3 (#16573)
http://hg.python.org/cpython/rev/ce3f0399ea33
History
Date User Action Args
2022-04-11 14:57:38adminsetgithub: 60777
2012-11-29 15:58:59python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg176657

resolution: fixed
stage: resolved
2012-11-29 15:58:58benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg176656
2012-11-28 23:58:00jpkottacreate