I have two iterators, a list and an itertools.count object (i.e. an infinite value generator). I would like to merge these two into a resulting ite
list
itertools.count
Why is itertools needed?
def imerge(a,b): for i,j in zip(a,b): yield i yield j
In this case at least one of a or b must be of finite length, cause zip will return a list, not an iterator. If you need an iterator as output then you can go for the Claudiu solution.