Skip to content

Reference: Collections

Quick-lookup pages. Short, dense, designed to skim. If you're here to learn the topic for the first time, start with Learn instead.

Pages in this section

  • Counter and defaultdict referenceCounter construction, most_common, elements, total, and the arithmetic operators; defaultdict factories and behaviour.
  • deque reference — the constructor (iterable, maxlen), every method, the complexity table, and a list-versus-deque comparison.
  • namedtuple, OrderedDict, and ChainMap reference — the namedtuple factory and its _-methods (_make, _asdict, _replace, _fields, defaults); OrderedDict extras (move_to_end, popitem); and ChainMap (maps, new_child, parents).