title: Pythonic way of iterating over 3D array
body: <p>I have a 3D array in Python and I need to iterate over all the cubes in the array.  That is, for all <code>(x,y,z)</code> in the array's dimensions I need to access the cube:</p>
  
  <pre><code>array[(x + 0, y + 0, z + 0)]
  array[(x + 1, y + 0, z + 0)]
  array[(x + 0, y + 1, z + 0)]
  array[(x + 1, y + 1, z + 0)]
  array[(x + 0, y + 0, z + 1)]
  array[(x + 1, y + 0, z + 1)]
  array[(x + 0, y + 1, z + 1)]
  array[(x + 1, y + 1, z + 1)]
  </code></pre>
  
  <p>The array is a Numpy array, though that's not really necessary.  I just found it very easy to read the data in with a one-liner using <code>numpy.fromfile()</code>.</p>
  
  <p>Is there any more Pythonic way to iterate over these than the following?  That simply looks like C using Python syntax.</p>
  
  <pre><code>for x in range(x_dimension):
      for y in range(y_dimension):
          for z in range(z_dimension):
              work_with_cube(array[(x + 0, y + 0, z + 0)],
                             array[(x + 1, y + 0, z + 0)],
                             array[(x + 0, y + 1, z + 0)],
                             array[(x + 1, y + 1, z + 0)],
                             array[(x + 0, y + 0, z + 1)],
                             array[(x + 1, y + 0, z + 1)],
                             array[(x + 0, y + 1, z + 1)],
                             array[(x + 1, y + 1, z + 1)])
  </code></pre>