<p dir="ltr">On 10 Dec 2014 16:38, "Chris Angelico" <<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>> wrote:<br>
><br>
> Would it be better to clarify that as "generator functions"? Maybe<br>
> something like this:<br>
><br>
> """<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>
> """</p>
<p dir="ltr">I find this more confusing than the original, actually, because now it sounds like you're saying that the distinction between a generator function and a generator instance is something new that this PEP is adding, in order to fix all the problems that are being caused by people writing 'for x in genfunc: ...'. Which doesn't make much sense. Like Nick said, it seems to me that the key distinction to emphasize is the distinction between generator function bodies and __next__ method bodies.</p>
<p dir="ltr">-n</p>