[New-bugs-announce] [issue28837] 2to3 does not wrap zip correctly
Carsten
report at bugs.python.org
Wed Nov 30 06:04:58 EST 2016
New submission from Carsten:
The following Python 2.7 code is not converted correctly to Python 3 by 2to3:
c = [(1, 10), (2, 20)]
# get a tuple with the first entries of every tuple in c,
# i.e. (1, 2)
x = zip(*c)[0]
print x
The result is
c = [(1, 10), (2, 20)]
# get a tuple with the first entries of every tuple in c,
# i.e. (1, 2)
x = zip(*c)[0]
print(x)
However running it with python3 gives the following exception
Traceback (most recent call last):
File "result.py", line 7, in <module>
x = zip(*c)[0]
TypeError: 'zip' object is not subscriptable
Tested with 2to3-2.7 and 2to3-3.4 on debian stable (jessie)
----------
components: 2to3 (2.x to 3.x conversion tool)
messages: 282075
nosy: cvk
priority: normal
severity: normal
status: open
title: 2to3 does not wrap zip correctly
type: behavior
versions: Python 2.7, Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28837>
_______________________________________
More information about the New-bugs-announce
mailing list