On Thu, 22 Oct 2020 at 22:09, Marco Sulla <[email protected]>
wrote:
> Not sure because I never tried or needed, but if no @abstractsomething in
> A is defined and your B class is a subclass of A, B should be an abstract
> class, not a concrete class.
>
Now I'm sure:
>>> from abc import ABC, abstractmethod
>>> class A(ABC): pass
...
>>> class B(A):
... @abstractmethod
... def hello(self):
... print("hello")
...
>>> B()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Can't instantiate abstract class B with abstract methods hello
>
>
--
https://mail.python.org/mailman/listinfo/python-list