title: Generator function behaving differently on lists and generator expressions?
body: <p>So I wrote this useless generator function that consumes the first 4 elements of an iterator:</p>
  
  <pre><code>def f(it):
      for _ in range(2):
          for _, x in zip(range(2), it):
              yield x
  </code></pre>
  
  <p>The following example as I expected:</p>
  
  <pre><code>y = (x for x in range(4))
  for x in f(y):
      print(x)
  0
  1
  2
  3
  </code></pre>
  
  <p>This example puzzles me:</p>
  
  <pre><code>for x in f([0, 1, 2, 3]):
      print(x)
  0
  1
  0
  1
  </code></pre>
  
  <p>Why are the two outputs different?</p>