[Python-ideas] PEP 479: Change StopIteration handling inside generators
Alexander Belopolsky
alexander.belopolsky at gmail.com
Mon Nov 24 19:02:02 CET 2014
On Mon, Nov 24, 2014 at 12:23 PM, Chris Angelico <rosuav at gmail.com> wrote:
> Well, there is probably more to be said about this - along the lines
> of *why* generators ought to be more like iterators. (They're
> iterables, not iterators.)
>
If generators are not iterators, how do you explain this?
>>> import collections
>>> def g():
... yield 42
...
>>> isinstance(g(), collections.Iterator)
True
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20141124/d63ea8c8/attachment.html>
More information about the Python-ideas
mailing list