Python Collections & Iteration
Collections & Iteration — Iterator tools, collections, functional programming, queues. This group brings together the Collections Module, Itertools Module, Functools Module, Operator Module, Bisect Module, Heapq Module, Weakref Module, Queue Module categories of the Python standard library. collections.deque() returns a double-ended queue (deque) with efficient O(1) appends/pops from both ends. deque.append() adds x to the right side of the deque. deque.appendleft() adds x to the left side of the deque. deque.pop() removes and returns the rightmost element. Raises IndexError if empty. deque.popleft() removes and returns the leftmost element. Raises IndexError if empty. Representative APIs from this group include collections.deque(), deque.append(), deque.appendleft(), deque.pop(), deque.popleft(), deque.extend(), deque.extendleft(), deque.rotate(). Each category page in this group lists its functions with syntax, parameters, return values, and runnable examples, so the group works as a map of a whole area of the standard library.