I know how to remove elements from a list while iteration. What about similar operation in deque? In the following example, 'my_deque' is a deque.
for event in my_deque.copy(): if event in event_sets: remove event from my_deque Is there some way to do this? Can deque only push and pop from two ends?
dequehas a 'remove' method.