... continued
Continues the discussion on coroutines.
You would realize that in the previous sections you were essentially dealing with coroutines when sending and receiving data. Similar to a generator, a coroutine executes in response to send()
and next()
calls. Simply creating a coroutine will not execute it. Let's revisit a coroutine example.
Coroutine Example
In Python 2.5 three APIs were added for generator objects, which allowed a generator to act as a coroutine which can collaborate with the caller, yielding ...