What should I put in the body of an abstract method?

The documentation does aim to give you an example. You don’t have to follow it.

You could provide a default; subclasses are still free to use super() to call your implementation. This is what most of the collections.abc classes do; see the source code.

Size for example, returns 0 for __len__:

class Sized(metaclass=ABCMeta):
    # ...
    @abstractmethod
    def __len__(self):
        return 0

Leave a Comment