I've to execute multiple steps and the order of them matters.
StepOne(arg1, arg2).execute()
StepTwo(arg1, arg2).execute()
StepThree(arg1, arg2).execute()
StepFour(arg1, arg2).execute()
StepFive(arg1, arg2).execute()
They all inherit from the same class Step
and receive the same 2 args.
class Step:
def __init__(self, arg1, arg2):
self.arg1 = arg1
self.arg2 = arg2
def execute(self):
raise NotImplementedError('This is an "abstract" method!')
There are any other, and more 'pythonic', way to call these steps? Any design pattern that helps here?
Aucun commentaire:
Enregistrer un commentaire