Author cvk
Recipients cvk
Date 2016-11-30.11:04:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480503898.29.0.0471565347052.issue28837@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2016-11-30 11:04:58cvksetrecipients: + cvk
2016-11-30 11:04:58cvksetmessageid: <1480503898.29.0.0471565347052.issue28837@psf.upfronthosting.co.za>
2016-11-30 11:04:58cvklinkissue28837 messages
2016-11-30 11:04:57cvkcreate