Message282075
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) |
|
Date |
User |
Action |
Args |
2016-11-30 11:04:58 | cvk | set | recipients:
+ cvk |
2016-11-30 11:04:58 | cvk | set | messageid: <1480503898.29.0.0471565347052.issue28837@psf.upfronthosting.co.za> |
2016-11-30 11:04:58 | cvk | link | issue28837 messages |
2016-11-30 11:04:57 | cvk | create | |
|