[Python-ideas] x=(yield from) confusion [was:Yet another alternative name for yield-from]
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Apr 7 07:42:48 CEST 2009
Jacob Holm wrote:
> One major reason for factoring something out of a coroutine would be if
> the factored-out code was independently useful as a coroutine.
So provide another entry point for using that part
as a top level, or manually apply the wrapper when
it's appropriate.
I find it extroardinary that people seem to have
latched onto David Beazley's idiosyncratic definition
of a "coroutine" and decided that it's written on
a stone tablet from Mt. Sinai that we must always
wrap them in his decorator.
> @coroutine
> def avg_diff():
> a = yield from avg2() start None # "start EXPR" means use EXPR for
> first value to yield instead of next()
> b = yield from avg2() start a # "start EXPR" means use EXPR for
> first value to yield instead of next()
I'm going to need a less abstract example to see
why you might want to do something like that.
--
Greg
More information about the Python-ideas
mailing list