classification
Title: 2to3 should translate itertools.imap into generator expression, not list comprehension
Type: behavior Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: wolever Nosy List: collinwinter, dangyogi, rhettinger, wolever
Priority: normal Keywords:

Created on 2008-03-19 19:34 by dangyogi, last changed 2008-03-20 00:15 by rhettinger. This issue is now closed.

Messages (5)
msg64092 - (view) Author: Bruce Frederiksen (dangyogi) Date: 2008-03-19 19:34
2to3, svn rev 61623 translates itertools.imap(lambda x: ..., ...) into a
list comprehension.  This should be translated instead into a generator
expression so that doing itertools.imap on infinite iterators still works.
msg64094 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-03-19 20:28
Why isn't itertools.imap() being translated directly to builtins.map()?
msg64114 - (view) Author: David Wolever (wolever) * (Python committer) Date: 2008-03-19 22:25
itertools.imap is being translated directly to map... But I bet this is 
another one of those ordering problems -- itertools.imap is converted to 
the map, then the map is converted to list(map(...)) because fix_map 
doesn't know that map was already fixed.
msg64130 - (view) Author: David Wolever (wolever) * (Python committer) Date: 2008-03-20 00:10
Ok, I've added explicit ordering to fixers in r61654, fixing this issue.
msg64131 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-03-20 00:15
Thanks David.
History
Date User Action Args
2008-03-20 00:15:37rhettingersetmessages: + msg64131
2008-03-20 00:10:53woleversetstatus: open -> closed
messages: + msg64130
2008-03-19 22:25:20woleversetassignee: collinwinter -> wolever
messages: + msg64114
nosy: + wolever
2008-03-19 20:28:29rhettingersetnosy: + rhettinger
messages: + msg64094
2008-03-19 19:34:53dangyogicreate