[Python-ideas] Revised revised revised PEP on yield-from

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 17 06:44:29 CET 2009

Guillaume Chereau wrote:

> But what I don't really like with it, is that when you start to write
> coroutines, you have to use yield every time you call an other
> coroutine,

Yes, but that's unavoidable as long as you're faking
things with generators instead of using real threads,
unless some other construct is introduced that's
tantamount to 'yield' by another name -- and then
you have to remember to use that.

> and it make the code full of yield statement ; the proposal
> if adopted would make it even worst.

I don't see how it would be any worse. Your code at
first glance looks incomprehensible to me -- how am I
supposed to know that the first 'yield' is a blocking
operation while the second one is returning a value?
It relies on obscure conventions implemented by some
kind of wrapper that you have to learn about.


More information about the Python-ideas mailing list