Everyone (including Chris), hold your horses. I will come up with better
words for the PEP. I apologize for the confusion.
On Wed, Dec 10, 2014 at 9:37 AM, Nathaniel Smith
On 10 Dec 2014 16:38, "Chris Angelico"
wrote: Would it be better to clarify that as "generator functions"? Maybe something like this:
""" Under this proposal, generator functions and iterators would be distinct, but related, concepts. Like the mixing of text and bytes in Python 2, the mixing of generators and iterators has resulted in certain perceived conveniences, but proper separation will make bugs more visible. The distinction is simple: A generator function returns a generator object. The latter is an iterator, having proper __iter__ and __next__ methods, while the former has neither and does not follow iterator protocol. """
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.
-n
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido)