I want the new class to dynamically inherit from different parents depending on an attribute given when creating an instance. So far I've tried something like this:
class Meta(type):
chooser = None
def __call__(cls, *args, **kwars):
if kwargs['thingy'] == 'option':
Meta.choose = option
return super().__call__(*args, **kwargs)
def __new__(cls, name, parents, attrs):
if Meta.choose == option:
bases = (parent1)
return super().__new__(cls, name, parents, attrs)
It doesn't work, is there a way that, depending on one of the parameters of the instance, I can dynamically choose a parent for the class?