How to explain coroutine in Tornado and Python? -
i know coroutine in python use get = yield ret
, callee.send()
, callee.next()
. havn't find above things such call.send()
in tornado source code gen.py. how explain coroutine in tornado easy understand way? without bigger picture, can't understand tornado did.
gen.py
does call send()
, in runner.run()
, not in engine()
or coroutine()
might expect.
it seems engine()
, coroutine()
evaluate wrapped function see whether returns generator. if does, calls runner.run()
on result, internally seems loop on send()
. it's not obvious it's doing though...
Comments
Post a Comment