I am calling a constructor in ClassA and want to have the resulting object be of a different class (ClassB) if a certain condition is met. I\'ve tried replacing the first a
I would suggest using a factory pattern for this. For example:
def get_my_inst(the_number): if the_number > 10: return ClassB(the_number) else: return ClassA(the_number) class_b_inst = get_my_inst(500) class_a_inst = get_my_inst(5)