Since a deque is a doubly linked list, I should be able to iterate through it in order without any performance cost compared to a list. However, the following will be much slower than iterating through a list
for i in range(0, len(d)):
doSomethingWith(d[i])
Since each time it goes to d[i]
starting at d[0]
. How do I make it iterate properly?
deque
provided its own iterator, use it.