generator/coroutine terminology

Marko Rauhamaa marko at pacujo.net
Sat Mar 14 20:48:50 EDT 2015


Chris Angelico <rosuav at gmail.com>:
> On Sun, Mar 15, 2015 at 11:15 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> What features do generator iterators provide on top of generic
>> iterators?
>> You can send values into them, throw exceptions into them, and close
> them (which is a special case of the latter).

Hm. I wonder why the distinction was made. IOW, why is
 iter([1, 2, 3])
not equivalent with
 (x for x in [1, 2, 3])
I can close the latter but not the former.
After all,
 yield from [1, 2, 3]
works all right.
Marko


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /