title: Storing Arrays when looping through thousands of parameters
body: <p>I need to loop through every combination of 6 arrays of size 5 (5^6 combinations). After each loop I need to store a function output along with what each of those numbers were. For example: </p>
  
  <pre><code>def function1(a, b, c, d, e, f): 
  
      return output
  
  for A,B,C,D,E,F in [(A,B,C,D,E,F) for A in a for B in b for C in c for 
                      D in d for E in e for F in f]:
      function1(A,B,C,D,E,F)
  </code></pre>
  
  <p>In the above example for each iteration I would need to store the output of "function1" along with all the parameters that went into function1 a-j. What is the most pythonic way to organize this? I was going to do this: </p>
  
  <pre><code> all_results = np.zeros(5^6,7)
  
  for ....
      answer = function1(a,b,c,d,e,f)
      all_results[i,:] = [answer, a,b,c,d,e,f]
  </code></pre>
  
  <p>But thought that it might be slow and archaic.  Is there a better way to do this. </p>