title: Best way to enumerate a cartesian product with labels in python?
body: <p>Given a dictionary mapping variables to possible outcomes:
  <code>{ 'lblA' : [False, True], 'lblB' : [False, True], 'lblC' : [0,1,2] }</code></p>
  
  <p>I want to enumerate all possible dictionary outcomes:</p>
  
  <pre><code>[ { 'lblA' : False , 'lblB' : False, 'lblC' : 0 },
  { 'lblA' : True , 'lblB' : False, 'lblC' : 0 },
  { 'lblA' : False , 'lblB' : True, 'lblC' : 0 },
  { 'lblA' : True , 'lblB' : True, 'lblC' : 0 },
  { 'lblA' : False , 'lblB' : False, 'lblC' : 1 },
  { 'lblA' : True , 'lblB' : False, 'lblC' : 1 },
  { 'lblA' : False , 'lblB' : True, 'lblC' : 1 },
  { 'lblA' : True , 'lblB' : True, 'lblC' : 1 },
  { 'lblA' : False , 'lblB' : False, 'lblC' : 2 },
  { 'lblA' : True , 'lblB' : False, 'lblC' : 2 },
  { 'lblA' : False , 'lblB' : True, 'lblC' : 2 },
  { 'lblA' : True , 'lblB' : True, 'lblC' : 2 } ]
  </code></pre>
  
  <p>I know that this could be done recursively, but I'd really like to do it with <code>itertools</code> for speed.</p>
  
  <p>Does anyone know the best way to do this?</p>
  
  <p>Thanks a lot for your help!</p>
  
  <h2>Edit</h2>
  
  <p>I want to do this for an arbitrary dictionary.</p>