I have 3 classes, they inherit from parent class. A parameter in the init method of the child classes is used to define in parent to set a parameter an define how a method is called.
class Parent(object):
def __init__(self, marker):
self.executeCode(marker)
class ClassA(Parent):
def __init__(self, marker):
super(ClassA, self).__init__("class_a")
class ClassB(Parent):
def __init__(self, marker):
super(ClassB, self).__init__("class b")
class ClassC(Parent):
def __init__(self, marker):
super(ClassC, self).__init__("class c")
Which is the best pattern to use here, to make it more pythonic?
Aucun commentaire:
Enregistrer un commentaire