[issue21628] 2to3 does not fix zip in some cases

2014-06-01 Thread RobertG

New submission from RobertG:

Consider this program

def foo(a,b):
return min(zip(a,b)[2])

print foo(range(5), (0,9,-9))

With the default options, 2to3 rewrites this as

def foo(a,b):
return min(zip(a,b)[2])

print(foo(list(range(5)), (0,9,-9)))

For some reason, 2to3 fails to wrap the call to zip in a list, even though the 
2to3 documentation says that there is a fixer which does this. Obviously, the 
generated code will not work in Python 3 since you can't subscript an iterator.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 219511
nosy: RobertG
priority: normal
severity: normal
status: open
title: 2to3 does not fix zip in some cases
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue21628>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20742] 2to3 zip fixer doesn't fix for loops.

2014-09-28 Thread RobertG

RobertG added the comment:

As far as a non contrived example, see http://bugs.python.org/issue21628, which 
was marked as a duplicate of this bug.

This bug is the main thing preventing me from using 2to3, so I think it is a 
real issue.

--

___
Python tracker 
<http://bugs.python.org/issue20742>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com