collections.deque

class collections.deque

deque([iterable[, maxlen]]) –> deque object

Build an ordered collection with optimized access from its endpoints.

Methods

__copy__ Return a shallow copy of a deque.
__format__ default object formatter
__new__((S, ...)
__reduce__ Return state information for pickling.
__reduce_ex__ helper for pickle
__reversed__ D.__reversed__() – return a reverse iterator over the deque
__sizeof__ D.__sizeof__() – size of D in memory, in bytes
__subclasshook__ Abstract classes can override this to customize issubclass().
append Add an element to the right side of the deque.
appendleft Add an element to the left side of the deque.
clear Remove all elements from the deque.
count(...)
extend Extend the right side of the deque with elements from the iterable
extendleft Extend the left side of the deque with elements from the iterable
pop Remove and return the rightmost element.
popleft Remove and return the leftmost element.
remove D.remove(value) – remove first occurrence of value.
reverse D.reverse() – reverse IN PLACE
rotate Rotate the deque n steps to the right (default n=1).

Attributes

maxlen maximum size of a deque or None if unbounded