collections.deque.remove()

remove(value) Remove the first occurrence of value. If not found, raises a ValueError.

collections.deque.popleft()

popleft() Remove and return an element from the left side of the deque. If no elements are present, raises an IndexError.

collections.deque.index()

index(x[, start[, stop]]) Return the position of x in the deque (at or after index start and before index stop). Returns the first match or raises ValueError if not found. New in version 3.5.

collections.deque.insert()

insert(i, x) Insert x into the deque at position i. If the insertion would cause a bounded deque to grow beyond maxlen, an IndexError is raised. New in version 3.5.

collections.deque.extendleft()

extendleft(iterable) Extend the left side of the deque by appending elements from iterable. Note, the series of left appends results in reversing the order of elements in the iterable argument.

collections.deque.count()

count(x) Count the number of deque elements equal to x. New in version 3.2.

collections.deque.copy()

copy() Create a shallow copy of the deque. New in version 3.5.

collections.deque.extend()

extend(iterable) Extend the right side of the deque by appending elements from the iterable argument.

collections.deque

class collections.deque([iterable[, maxlen]]) Returns a new deque object initialized left-to-right (using append()) with data from iterable. If iterable is not specified, the new deque is empty. Deques are a generalization of stacks and queues (the name is pronounced “deck” and is short for “double-ended queue”). 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. Though list objects sup

collections.deque.clear()

clear() Remove all elements from the deque leaving it with length 0.