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 it is Dinherited from tupleand P, while it is Cinherited only from P.
Now this behavior: c = C()got an error, as expected:
TypeError: Can't instantiate abstract class C with abstract methods foo
but it d = D()works without errors!
I can even call d.foo(). How can I explain this behavior?
source
share