Skip to content

bpo-28837: Fix lib2to3 handling of map/zip/filter#24

Merged
benjaminp merged 1 commit intopython:masterfrom
stuarteberg:patch-lib2to3-zip-map-filter
Apr 6, 2017
Merged

bpo-28837: Fix lib2to3 handling of map/zip/filter#24
benjaminp merged 1 commit intopython:masterfrom
stuarteberg:patch-lib2to3-zip-map-filter

Conversation

@stuarteberg
Copy link
Contributor

@stuarteberg stuarteberg commented Feb 11, 2017

The 2to3 tool will automatically wrap calls to map, zip, and filter with list():

# Original:
zip('abc', '123')

# After 2to3:
list(zip('abc', '123'))

...but the tool misses some cases, if the call is followed by a "trailer" such as [0]:

# Skipped by 2to3:
zip('abc', '123')[0]

This PR augments the lib2to3 "fixers" for map, zip, and filter to correctly handle such cases.

http://bugs.python.org/issue28837

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants