Mapping ABC (and friends): are the mixin methods *required* to satisfy the interface?

Thanks for the reply. Mapping in particular is a tricky case compared to some of the “lower-level” ABCs. For example Sized implements __subclasshook__ in such a way that for any class that has a __len__, issubclass(cls, Sized) returns true.

Likewise for issubclass(cls, Container) for any class that implements __contains__.

But for Mapping there are additional requirements of the interface which cannot be simply checked statically, such as that its __iter__ must return an iterator over the “keys” in mapping. So there is no Mapping.__subclasshook__ that can state simply whether a given class is a Mapping.

My question is really, simply put, for a class to satisfy an ABC interface, must it implement them methods listed in this table from the “Mixin Methods” column. I can’t find anything explicitly stating this. Though I think I did find an answer implicitly:

At least in the case of the Iterator ABC it implements a __subclasshook__ that requires both __next__ and __iter__ to be implemented. In that class, only __next__ is an abstract method, whereas __iter__ is mixin method with a default implementation provided by the Iterator class. But since the __subclasshook__ requires both of them, that implies that the mixin methods must be implemented as well. In the case of Iterator it makes sense because Python requires all iterators to also be iterables.