October 2018
Beginner to intermediate
398 pages
11h 1m
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. |