The collections.abc module provides a wealth of ABCs that decompose collections into a number of discrete feature sets. A related set of features of a class is called a protocol: the idea is that things such as getting, setting, and deleting items are the protocol for list-like behavior. Similarly, the __iter__() method is part of the protocol for defining an iterable collection. A list often implements both protocols, but some data structures may support fewer protocols. Support for a given protocol is often exploited by mypy algorithms to determine whether an object is being used properly.
We can successfully use the list class without thinking too deeply about the various features and how they relate to the set class or the dict class. Once we start looking at the ABCs, however, we can see that there's a bit of subtlety to these classes. By decomposing...