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
I'm not sure what your application is, but you might find the enumerate() function more useful.
>>> items = ['foo', 'bar', 'baz'] >>> for i, item in enumerate(items): ... print item ... print i ... foo 0 bar 1 baz 2