Suppose I have a class X
and a class Y
, is it possible to dynamically define a class that has X as a base, but also methods of Y.
def combiner(base_class, derived_class):
return derived_class(base_class) # returns a class
some_class = combiner(x, Y)
my_object = some_class()
This is somewhat of a pseudocode, is it possible to make something like this work in python?