Why does zip() drop the values of my generator?
<p>I was writing an answer to <a href="http://stackoverflow.com/questions/11205037/detect-period-of-unknown-source">this question</a> when noticed that my simple implementation didn't produce correct results. While hunting down the bug, I noticed the following:</p>

<pre><code>In [1]: import itertools
In [2]: gen = itertools.cycle((0,1,2))

In [3]: zip(gen, range(3))
Out[3]: [(0, 0), (1, 1), (2, 2)]

In [4]: zip(gen, range(3))
Out[4]: [(1, 0), (2, 1), (0, 2)]
</code></pre>

<p>For whatever reason, <code>gen</code>'s <code>next()</code> method is called one additioinal time.
To illustrate this, I used the following:</p>

<pre><code>class loudCycle(itertools.cycle):
    def next(self):
        n = super(loudCycle, self).next()
        print n
        return n

In [6]: gen = loudCycle((0,1,2))
In [7]: zip(gen, range(3))
0
1
2
0
Out[7]: [(0, 0), (1, 1), (2, 2)]
</code></pre>
