An elegant and fast way to consequently iterate over two or more containers in Python?
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)  
    
    for obj in deque2:  
        some_action(obj)
    
    for obj in deque3:  
        some_action(obj)

I'm looking for some function XXX which would ideally allow me to write:

    for obj in XXX(deque1, deque2, deque3):  
        some_action(obj)

The important thing here is that XXX have to be efficient enough - without making copy or silently using range(), etc. I was expecting to find it in built-in functions, but I found nothing similar to it so far.

Is there such thing already in Python or I have to write a function for that by myself?

An elegant and fast way to consequently iterate over two or more containers in Python?
===

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)  
    
    for obj in deque2:  
        some_action(obj)
    
    for obj in deque3:  
        some_action(obj)

I'm looking for some function XXX which would ideally allow me to write:

    for obj in XXX(deque1, deque2, deque3):  
        some_action(obj)

The important thing here is that XXX have to be efficient enough - without making copy or silently using range(), etc. I was expecting to find it in built-in functions, but I found nothing similar to it so far.

Is there such thing already in Python or I have to write a function for that by myself?
