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.

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:
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.

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, 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)

New changeset 4ff17cf130eb by Benjamin Peterson in branch '3.3':
merge 3.2 (#16573)

New changeset 2bb604a691de by Benjamin Peterson in branch '2.7':
enumerate only requires an iterable (closes #16573)

New changeset ce3f0399ea33 by Benjamin Peterson in branch 'default':
merge 3.3 (#16573)
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