I have a base class Foo and another base class Bar.
I would like to create two sets of Baz classes (e.g., Baz1, ..., Baz20) such that for each N from 1 to 20, there's a BazN class that inherits from Foo, and also a BazN class that inherits from Bar. So I'd end up with 40 BazN classes, 20 of which are BazNFoo and 20 of which are type BazNBar.
What I have is the below snippet, which explicitly writes each BazN class twice, once inheriting from Foo and once from Bar. My question is, is there a programmatic way to do this writing each BazN class just once? My Baz classes are pretty long.
class Foo:
def __init__(self):
# code specific to Foo
class Bar:
def __init__(self):
# code specific to Bar
class Baz1Foo(Foo):
def __init__(self):
super().__init__()
# code specific to Baz1
class Baz1Bar(Bar):
def __init__(self):
super().__init__()
# code specific to Baz1
class Baz2Foo(Foo):
...