[Python-ideas] x=(yield from) confusion [was:Yet another alternative name for yield-from]

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 9 01:34:34 CEST 2009


Jacob Holm wrote:

> You can't do this by just providing a value to yield on the first 
> next().

I don't see how providing an initial yield value directly
to the yield-from expression can give you any greater
functionality, though. Can you post a complete example
of that so I don't have to paste code from several messages
together?

> The modified parser example I sent to Greg shows that there is 
> a use case for it

FWIW, that example doesn't fit David Beazley's definition of
a coroutine, since it uses yields to both send and receive
values. He doesn't think that's a sane thing to do.

> I don't agree that it is a bad idea to call next automatically.  I can 
> see that it is necessary to keep a version around that doesn't do it, 
> but that is because of limitations in yield-from.

An alternative viewpoint would be the idea that a coroutine
should always start itself automatically is too simplistic.

-- 
Greg



More information about the Python-ideas mailing list