title: Python for loop offset (Itertools.product)
body: <p>The following code generates all possible combinations using <code>0</code> and <code>1</code>, where four digits have to be used.</p>
  
  <pre><code>import itertools
  for i in itertools.product([0, 1], repeat=4):
      print i
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>(0, 0, 0, 0)(0, 0, 0, 1)(0, 0, 1, 0)(0, 0, 1, 1)(0, 1, 0, 0)(0, 1, 0, 1)(0, 1, 1, 0)(0, 1, 1, 1)(1, 0, 0, 0)(1, 0, 0, 1)(1, 0, 1, 0)(1, 0, 1, 1)(1,1, 0, 0)(1, 1, 0, 1)(1, 1, 1, 0)(1, 1, 1, 1)
  </code></pre>
  
  <p>I would like to be able to set an offset for the for loop. Example:</p>
  
  <pre><code>import itertools
  offSet = 10
  for i in itertools.product([0, 1], repeat=4):
      # Some code that applies the offset
      print i
  </code></pre>
  
  <p>Which would then output:</p>
  
  <pre><code>(1, 0, 1, 0)(1, 0, 1, 1)(1,1, 0, 0)(1, 1, 0, 1)(1, 1, 1, 0)(1, 1, 1, 1)
  </code></pre>
  
  <p><strong>How can I apply a such offset to this for loop?</strong></p>
  
  <p><em>Note: The code being used is simplified. As I am actually using a very large value for <code>repeat</code>, <strong>performance matters</strong>. I cannot afford the possible combinations before the offset to be calculated.</em></p>