Chapter 2. Data Structures

Python includes several standard programming data structures, such as list, tuple, dict, and set, as part of its built-in types. Many applications do not require other structures, but when they do, the standard library provides powerful and well-tested versions that are ready to be used.

The enum (page 66) module provides an implementation of an enumeration type, with iteration and comparison capabilities. It can be used to create well-defined symbols for values, instead of using literal strings or integers.

The collections (page 75) module includes implementations of several data structures that extend those found in other modules. For example, Deque is a double-ended queue, which allows the addition or removal of ...

Get The Python 3 Standard Library by Example, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.