Skip to content

collections

jasper-zanjani edited this page Aug 6, 2020 · 1 revision

collections.abc

provides Mapping and MutableMapping ABCs to formalize the interfaces of dict and similar types [FP][FP]:64

collections.ChainMap

Lookups are performed on each mapping in order

collections.Counter

Holds an integer count for each key; each new key adds to the count

collections.defaultdict

a [PiaN][PiaN]: 174

collections.deque

Thread-safe double-ended queue that supports most list methods FP:54-56, PiaN: 173

collections.namedtuple

Card = namedtuple('Card',['rank','suit'])`
City = namedtuple('City', 'Name Country Population Coordinates'.split(' ')]

collections.OrderedDict

Maintains keys in insertion order

collections.UserDict

Designed to be subclassed

Clone this wiki locally