Best Design Pattern to execute steps in python
<p>I have to execute multiple actions sequentially in an order dependant manner. </p>

<pre><code>StepOne(arg1, arg2).execute()
StepTwo(arg1, arg2).execute()
StepThree(arg1, arg2).execute()
StepFour(arg1, arg2).execute()
StepFive(arg1, arg2).execute()
</code></pre>

<p>They all inherit from the same <code>Step</code> class and receive the same 2 args.</p>

<pre><code>class Step:
    def __init__(self, arg1, arg2):
        self.arg1 = arg1
        self.arg2 = arg2

    def execute(self):
        raise NotImplementedError('This is an "abstract" method!')
</code></pre>

<p>What's the most idiomatic way to execute these actions in order? Is there a design pattern that would apply here?</p>

<p>You could create a list of the step classes, then instantiate and call them in a loop.</p>

<pre><code>step_classes = [StepOne, StepTwo, StepThree, ...]

for c in step_classes:
    c(arg1, arg2).execute()
</code></pre>

python oop design-patterns