I have run into a strange issue in Python 3.4.3, and it doesn't seem to be mentioned anywhere.
Lets say: a = [1,2,3,4] and b = [5,6,7,8]
To concatenate these vertically: ab = zip(a,b)
in python 3, ab itself would return:
zip object at (some hexnumber)
All well here, in python 3, to retrieve the concatenated list: aabb = list(ab)
Now heres the issue, first time, aabb will indeed return a real list: [(1, 5), (2, 6), (3, 7), (4, 8)]
Second time and onwards however, if you do the whole process again list(aabb) will simply return an empty [] container, just like list() would do.
It will only work again after I restart shell/interpreter.
Is this normal or a bug?
EDIT: Ok guys I didn't realise it was to do with zip, it SEEMED constant as ab returned the same hex value everytime so I thought it was to do with list(ab).
Anyway, worked out by reassigning ab = zip(ab)
From what I understand in answers and original link, ab gets disposed once read.
list(list(zip([1,2,3,4], [5,6,7,8]))) == []. perhaps you can explain? @DonD, this is what you're saying you're getting? - dblisslist(aabb)doesn't return an empty list as the argument is a filled list not an empty iterator. The question states an incorrect problem without a full code sample. - Malik Brahimi