Configurable inheritance

Hi guys,

It's been a while.
After working in static .NET world for 3 years I am back in python dynamic magic.

Problem statement:
I have a child class that should inherit from ONLY ONE parent class. There are multiple classes for parent candidate. The selection of parent class goes through json config file. Is there a way to resolve the parent class in runtime.
class Child(Parent):

Kind Regards,


  • could you be more specific about the candidate classes? I highly suspect a better architecture would be to have those two classes share a base class.

    If you really need dynamic inheritance you can overload the __new__ operator in your Child class and take a generic Object to the constructor. Its all that pretty but it should work.
Sign In or Register to comment.