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

Leif Walsh leif.walsh at gmail.com
Sun Apr 5 01:22:53 CEST 2009


I haven't been following this discussion too much (as I would have no
time for anything else if I did, it seems), but I think I understand
the problem with priming a coroutine, and then trying to use it in
yield from, and I may have a solution.  I don't understand what it
means to 'yield from' a coroutine, but I'll here's my proposed fix:

Give all generators/coroutines a 'prime' (or better named) function.
This prime function can set some 'is_primed' internal variable so that
it never primes more than once.  Now, yield from and @coroutine can
(and this is the hazy part because I don't know what yield from is
really doing under the hood) both use prime(), so yielding from a
non-decorated coroutine will have the same effect as yielding from a
decorated coroutine.

-- 
Cheers,
Leif



More information about the Python-ideas mailing list