[Python-Dev] Return from generators in Python 3.2
Yury Selivanov
yselivanov at gmail.com
Fri Aug 27 02:05:52 CEST 2010
On 2010-08-26, at 8:04 PM, Greg Ewing wrote:
> Even with your proposal, you'd still have to use a 'creepy
> abstraction' every time one of your coroutines calls another.
> That's why PEP 380 deals with 'more than just return'.
Nope. In almost any coroutine framework you have a scheduler
or trampoline object that basically does all the work of calling,
passing values and propagating exceptions. And many other things
that 'yield from' won't help you with (cooperation, deferring to
process/thread pools, pausing, etc.) Being a developer of one
of such frameworks, I can tell you, that I can easily live without
'yield from', but dealing with weird return syntax is a pain.
Especially when you use decorators like @bus.method, or
@protocol.handler, that transparently wrap your callable be it
generator or regular function. And after that you have to use
different return syntax for them.
-
Yury
More information about the Python-Dev
mailing list