Python Coroutines

David Beazley’s Curious Course on Coroutines and Concurrency in Python is the best coroutine tutorial I’ve seen.

It makes an essential distinction between generators, from which you pull data, like this:

… and coroutines, through which you push data, like this:

I plan to spend a lot of time with coroutines in the next few months, in particular seeing how they can simplify coding in asynchronous Python web frameworks.