title: Iteration through all 1 dimensional subarrays of a multi-dimensional array
body: <p>What is the fastest way to iterate through all one dimensional sub-arrays of an n dimensional array in python.</p>
  
  <p>For example consider the 3-D array:</p>
  
  <pre><code>import numpy as np 
  a = np.arange(24)
  a = a.reshape(2,3,4)
  </code></pre>
  
  <p>The desired sequence of yields from the iterator is :</p>
  
  <pre><code>a[:,0,0]
  a[:,0,1]
  ..
  a[:,2,3]
  a[0,:,0]
  ..
  a[1,:,3]
  a[0,0,:]
  ..
  a[1,2,:]
  </code></pre>