Say I have the following abstract class Foo:
import abc
class Foo(abc.ABC):
@abc.abstractmethod
def bar(self):
raise NotImplem
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