I have two classes inheriting from the same parent P
:
from abc import ABCMeta, abstractmethod
class P(object):
__metaclass__ = ABCMeta
@abstractmethod
def foo(self):
pass
class C(P):
pass
class D(tuple, P):
pass
The only difference is that D
inherited from tuple
and P
while C
inherits from P
only.
Now this is the behavior: c = C()
got error, as expected:
TypeError: Can't instantiate abstract class C with abstract methods foo
but d = D()
works without error!
I can even call d.foo()
. How can I explain this behaviour?