deque are implemented a little smarter than just doubly-linked lists. They're a doubly-linked list of blocks of Python objects, where the left and right sides may be incomplete blocks.
The Big-O cost of accessing in the middle is still O(n), but it has a constant divisor (implementation dependent, CPython 3.5 allocates blocks that can store 64 objects). So if your deque has 1000 members, accessing in the middle still involves only around 7-8 "linked list-style" traversals, not 500-some. If the deque is smallish (65 to 128 elements, depending on how the empty slots align with the head and tail blocks), then lookup of any element is equal cost.
python - Deque (time complexity) - Stack Overflow
How to make dequeue o(1) operation rather than o(n)?
Big O Cheat Sheet: the time complexities of operations Python's data structures
What is Python's list.append() method WORST Time Complexity? It can't be O(1), right?
I would like to use queues for BFS problems but the thing is if I use a queue as an array I would have to remove from the beginning and shift everything down. Is there any other way to do iterative BFS without having such performance heavy operations? Iโm using python fyi