I have three collection.deques and what I need to do is to iterate over each of them and perform the same action:
for obj in deque1: some_action(obj)
Accepts a bunch of iterables, and yields the contents for each of them in sequence.
def XXX(*lists): for aList in lists: for item in aList: yield item l1 = [1, 2, 3, 4] l2 = ['a', 'b', 'c'] l3 = [1.0, 1.1, 1.2] for item in XXX(l1, l2, l3): print item 1 2 3 4 a b c 1.0 1.1 1.2