generator/coroutine terminology

Chris Angelico rosuav at gmail.com
Mon Mar 16 03:21:45 EDT 2015


On Mon, Mar 16, 2015 at 6:12 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
>
> I was actually referring to the offered API. It still seems to me like
> all iterators could offer close(), send() and throw(). Why? To make all
> iterators drop-in replacements of each other.
>
> Then, you could also stop wondering what to call the thingy returned by
> a generator. Why, it would be an iterator. You wouldn't then have any
> other use for a generator than the function that returns an iterator.

That just adds unnecessary overhead to every iterator. Also, what
happens when you throw something into iter([1,2,3]) ? Or send it a
value? What happens?

ChrisA



More information about the Python-list mailing list