This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients gvanrossum, scoder, vstinner, yselivanov
Date 2015-04-20.19:36:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429558585.89.0.729845325991.issue24018@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, CPython tends to assume that generators are always implemented by a Python function that uses the "yield" keyword. However, it is absolutely possible to implement generators as a protocol by adding send(), throw() and close() methods to an iterator.

The problem is that these will usually be rejected by code that needs to distinguish generators from other input, e.g. in asyncio, as this code will commonly do a type check against types.GeneratorType. Instead, it should check for the expected protocol. The best way to achieve this is to extend the existing ABCs with a Generator ABC that external generator implementations can register on.

Related to issue 24004 (asyncio). Asyncio could provide a backport copy of this for older Python versions.

I assume this is considered a new feature that cannot be added to 3.4 anymore?
History
Date User Action Args
2015-04-20 19:36:25scodersetrecipients: + scoder, gvanrossum, vstinner, yselivanov
2015-04-20 19:36:25scodersetmessageid: <1429558585.89.0.729845325991.issue24018@psf.upfronthosting.co.za>
2015-04-20 19:36:25scoderlinkissue24018 messages
2015-04-20 19:36:25scodercreate