May 2017
Intermediate to advanced
310 pages
8h 5m
English
The collections module provides more specialized, high, performance alternatives for the built-in data types as well as a utility function to create named tuples. The following table lists the datatypes and operations of the collections module and their descriptions:
|
Datatype or operation |
Description |
|
namedtuple() |
Creates tuple subclasses with named fields. |
|
deque |
Lists with fast appends and pops either end. |
|
ChainMap |
Dictionary like class to create a single view of multiple mappings. |
|
Counter |
Dictionary subclass for counting hashable objects. |
|
OrderedDict |
Dictionary subclass that remembers the entry order. |
|
defaultdict |
Dictionary subclass that calls a function to supply missing values. |