[Python-ideas] Generators are iterators

Ron Adam ron3200 at gmail.com
Thu Dec 11 21:39:56 CET 2014



On 12/11/2014 09:14 AM, Oscar Benjamin wrote:
> I think the PEP would be clearer if it properly acknowledged that the
> problem is a problem for all iterators. The question then is why the
> fix is only targeted at generators and what should be done about the
> same problem that occurs in many other forms. The PEP rationale avoids
> these issues by falsely claiming that generators are special.

It seems to me, the main benefit is for writers of nested generators and 
co-routines.  It makes those cases easier to debug, and may help generators 
in general be more reusable, and reliable, in the context of nested 
generators and co-routines.

Which if true could contribute to better, and more dependable, 
multi-thread, multi-process, or even multi-core, software designs.

That is the general impression I get from the conversations about the 
changes being made.  But I'm not sure I can point to any one message 
stating it like that.

Possibly someone can confirm if any of those points are valid and why.

Or it could be I'm just a bit too optimistic. ;-)

Cheers,
    Ron






More information about the Python-ideas mailing list