The standard library makes use of mixin class definitions. There are several modules that contain examples, including
When we define our own collection based on the
collections.abc abstract base classes, we're making use of mixins to assure that cross-cutting aspects of the containers are defined consistently. The top-level collections (
Mapping) are all built from multiple mixins. It's very important to look at section 8.4 of the Python Standard Library to see how the mixins contribute features, as the overall structure is built up from pieces.
Looking at just one line, the summary of
Sequence, we see that it inherits from ...