I would like to know if it is possible to use multiple inheritance with abstract base class in python. It seems like it should be possible but can't find a statement one way or the other.
The basic ABC example:
from abc import ABC, abstractmethod
class BaseABC(ABC):
@abstractmethod
def hello(self):
pass
class Child(BaseABC):
pass
child = Child()
This will fail due to "hello" not being implemented in "Child".
What I would like is to know how to combine ABC with multiple inheritance. I would like to make either the "BaseABC" or "Child" to inherit also from some other separate class. Explicitly:
from abc import ABC, abstractmethod
class BaseABC(ABC, dict):
@abstractmethod
def hello(self):
pass
class Child(BaseABC):
pass
child = Child()
This does not fail in the way expected as the first case does. Also:
from abc import ABC, abstractmethod
class BaseABC(ABC):
@abstractmethod
def hello(self):
pass
class Child(BaseABC, dict):
pass
child = Child()
This does not fail either. How can I require "Child" to implement "hello"?