title: Refactoring code to elegantly change looping position
body: <p>Say, I have a 3-step procedure to run. They have to be run in order:</p>
  <pre><code>step1(x)
  step2(y)
  step3(z)
  </code></pre>
  <p>I want to test a certain step with different parameters. So I am dreaming to have a function <code>test(step_num)</code> to help me elegantly indicate the location of the loop. For example, <code>test(1)</code> should give me</p>
  <pre><code>for x in range(0,10):
      step1(x)
      step2(y)
      step3(z)
  </code></pre>
  <p><code>test(2)</code> should give</p>
  <pre><code>step1(x)
  for y in range(0,10):
      step2(y)
      step3(z)
  </code></pre>
  <p>and <code>test(3)</code> should give</p>
  <pre><code>step1(x)
  step2(y)
  for z in range(0,10):
      step3(z)
  </code></pre>
  <p>Is it possible to achieve this? Any built-in feature from python I can use? In the real-life application, the number of steps could be &gt;=10, and that's why I think it could help reduce redundant code.</p>