title: Single Line Nested For Loops
body: <p>Wrote this function in python that transposes a matrix:</p>
  
  <pre><code>def transpose(m):
      height = len(m)
      width = len(m[0])
      return [ [ m[i][j] for i in range(0, height) ] for j in range(0, width) ]
  </code></pre>
  
  <p>In the process I realized I don't fully understand how single line nested for loops execute. Please help me understand by answering the following questions:</p>
  
  <ol>
  <li>What is the order in which this for loop executes?</li>
  <li>If I had a triple nested for loop, what order would it execute?</li>
  <li>What would be equal the equal unnested for loop?</li>
  </ol>
  
  <p>Given,</p>
  
  <pre><code>[ function(i,j) for i,j in object ]
  </code></pre>
  
  <ol>
  <li>What type must object be in order to use this for loop structure?</li>
  <li>What is the order in which i and j are assigned to elements in object?</li>
  <li>Can it be simulated by a different for loop structure?</li>
  <li>Can this for loop be nested with a similar or different structure for loop? And how would it look?</li>
  </ol>
  
  <p>Additional information is appreciated as well.</p>