vendredi 5 février 2016

Python - implement derived method with more arguments

I have BaseClass and many classes that inherits from it:

MyClass1(BaseClass)
MyClass2(BaseClass)
..
MyClassx(BaseClass)

in BaseClass I have method like this:

def someMethod (arg1, arg2, arg3):
    raise NotImplementedError()

and its implementation in each derived class

Now I would like to add one more argument to this method which will be relevant only for one of derived classes. What is the best practice to do this? Should I extend method in base class? Or maybe there is other solution?

Aucun commentaire:

Enregistrer un commentaire