Trying to solve my problem using chain from itertools. I have a list of iterators and I want to get an iterator that iterates through items of the iterators in the list in a seamless manner. Is there a way to do so? Perhaps another tool instead of chain would be more suitable?
Simplified example of my code:
iter1 = iter([1,2])
iter2 = iter([3,4])
iter_list = [iter1, iter2]
chained_iter = chain(iter_list)
Desired result:
chained_iter.next() --> 1
chained_iter.next() --> 2
chained_iter.next() --> 3
chained_iter.next() --> 4
Actual result:
chained_iter.next() --> <listiterator at 0x10f374650>