title: Python - corner coordinates of n-dimensional cube
body: <p>I'm trying to get the coordinates of an n-dimensional cube from a list of the mins and maxes for each dimension. I'm able to get the corners using for loops but I would like to generalize for any number of dimensions.</p>
  
  <p>So for instance:</p>
  
  <pre><code>mins = [-1,-2,-3]
  maxes = [1,2,3]
  </code></pre>
  
  <p>would give the coordinates:</p>
  
  <pre><code>(-1, -2, -3), (-1, -2, 3), (-1, 2, -3), (-1, 2, 3),
  (1, 2, 3), (1, 2, -3), (1, -2, 3), (1, -2, -3)
  </code></pre>
  
  <p>This is essentially finding all the paths through two lists, choosing a value from one of the lists for each index. I've seen algorithms to give the number of paths or the fastest path, but I haven't found one that enumerates all of the possible paths.</p>
  
  <p>I'd assume itertools would come into the solution, but cannot figure out how to use products, permutations, and combinations in way that gives the desired result. The closest has been:</p>
  
  <pre><code>list(itertools.product((xmin, xmax), (ymin, ymax), (zmin, zmax)))
  </code></pre>