I\'ve recently gotten into investigating how various data structures are implemented in Python in order to make my code more efficient. In investigating how lists and deques
The documentation entry for deque objects spells out most of what you need to know, I suspect. Notable quotes:
Deques support thread-safe, memory efficient appends and pops from either side of the deque with approximately the same O(1) performance in either direction.
But...
Indexed access is O(1) at both ends but slows to O(n) in the middle. For fast random access, use lists instead.
I'd have to take a look at the source to tell whether the implementation is a linked list or something else, but it sounds to me as though a deque
has roughly the same characteristics as a doubly-linked list.