<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 10, 2014 at 1:34 PM, Greg Ewing <span dir="ltr"><<a href="mailto:greg.ewing@canterbury.ac.nz" target="_blank">greg.ewing@canterbury.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Chris Angelico wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
"""<br>
Under this proposal, generator functions and iterators would be<br>
distinct, but related, concepts.  Like the mixing of text and bytes in<br>
Python 2, the mixing of generators and iterators has resulted in<br>
certain perceived conveniences, but proper separation will make bugs<br>
more visible. The distinction is simple: A generator function returns<br>
a generator object. The latter is an iterator, having proper __iter__<br>
and __next__ methods, while the former has neither and does not follow<br>
iterator protocol.<br>
"""<br>
</blockquote>
<br></span>
No, that's still too confused -- all of that was true before as<br>
well. Generator functions have never been iterators themselves.<br>
<br>
I think Nick has it nailed -- the difference is that code inside<br>
a generator function implementing a __next__ method will behave<br>
differently from that inside an ordinary function implementing<br>
a __next__ method.<span class="HOEnZb"><font color="#888888"></font></span><br clear="all"></blockquote></div><br></div><div class="gmail_extra">That's hardly news though. *Except* for the possibility of raising StopIteration to end the iteration, the inside of a generator has always been completely different from the inside of a __next__ method implementation.<br></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div>
</div></div>