Say I have a list of class objects in Python (A, B, C
) and I want to inherit from all of them when building class D
, such as:
class A(object):
pass
class B(object):
pass
class C(object):
pass
classes = [A, B, C]
class D(*classes):
pass
Unfortunately I get a syntax error when I do this. How else can I accomplish it, other than by writing class D(A, B, C)
? (There are more than three classes in my actual scenario)