generator/coroutine terminology
Marko Rauhamaa
marko at pacujo.net
Mon Mar 16 12:05:08 EDT 2015
Ian Kelly <ian.g.kelly at gmail.com>:
> Or inversely I write a normal utility function that is called from
> coroutines, then later add a "yield from" to it, and now I have to go
> back and revise every place where it's called to make those use "yield
> from" as well.
That is actually quite awkward. Smooth interlocking of coroutines
suggests you should be able to introduce a blocking state anywhere with
a "yield from" statement. To avoid the problem you mention, you'd then
have to give up direct function call altogether and yield from
everything under the sun:
# Use the supercomputer over RPC -- or not!
root = yield from my_math.sqrt(x)
It could be done, but it won't look like Python code anymore. It
probably won't look like a computer program anymore.
Marko
More information about the Python-list
mailing list