MemotivaStandard library essentials

What is collections.deque?

Standard library essentials

Audio flashcard · 0:13

Nortren·

What is collections.deque?

0:13

Deque is a double-ended queue with constant-time appends and pops from both ends, unlike a list which is linear time for left operations. It is the right choice for queues and stacks. It also supports fast rotation and bounded length via maxlen.
docs.python.org