generator/coroutine terminology

Chris Angelico rosuav at gmail.com
Sat Mar 14 20:22:57 EDT 2015


On Sun, Mar 15, 2015 at 11:15 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> On Sun, Mar 15, 2015 at 9:15 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>>> Is it necessary/useful for a Python application programmer to be
>>> conscious of the different types of iterator? What mistaken usage
>>> could arise if the application just treated all iterators as, well,
>>> iterators?
>>
>> If you treat them all as iterators, then you're safe, because that's
>> the lowest common denominator. But there are a number of other
>> iterators that have more features, including files, generators, etc.
>
> 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).

ChrisA



More information about the Python-list mailing list