Consider this code
from abc import ABCMeta, abstractmethod
class C():
@abstractmethod
def my_abstract_method(self):
print('foo')
class D(C):
pass
x = C()
y = D()
Neither x
nor y
is allowed by mypy yielding me a
test.py:13: error: Cannot instantiate abstract class 'C' with abstract attribute 'my_abstract_method'
test.py:15: error: Cannot instantiate abstract class 'D' with abstract attribute 'my_abstract_method'
I'm testing this with mypy 0.570
and python 3.6.3
However, the documentation says that I'd need to set metaclass=ABCMeta
for that to work. What am I missing?