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 Ben.Darnell, gvanrossum, ncoghlan, scoder, vstinner, yselivanov
Date 2015-06-08.15:56:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433778986.86.0.000101168103902.issue24400@psf.upfronthosting.co.za>
In-reply-to
Content
I agree that the "extra bit" is a quirk. Ideally, Coroutine and Generator would share a common base class that has "send", "throw" and "close". Additionally, a Coroutine would be an Awaitable whereas a Generator is an Iterator. The internal implementation of generators and coroutines would (or at least, could) then follow by splitting them into separate types.

The tricky bridge between the two is the types.coroutine() decorator, which is intended to say "this Generator is a Coroutine", i.e. it turns a Generator into an Awaitable Generator. As the current implementation shows, however, this can also be done without the internal flag. All this needs is a wrapper, and that could be implemented in C to make it fast and even special cased to further speed it up.

In a way, the current implementation focusses on runtime optimisation, not on a clean design.
History
Date User Action Args
2015-06-08 15:56:26scodersetrecipients: + scoder, gvanrossum, ncoghlan, vstinner, Ben.Darnell, yselivanov
2015-06-08 15:56:26scodersetmessageid: <1433778986.86.0.000101168103902.issue24400@psf.upfronthosting.co.za>
2015-06-08 15:56:26scoderlinkissue24400 messages
2015-06-08 15:56:26scodercreate