The Open Source Bridge conference recently published this video of me building, in barely 30 minutes, a Python 3 async framework with non-blocking I/O and coroutines. Here's the code I demonstrated.

Python 3's new "asyncio" module is an efficient async framework similar to Node. But unlike Node, it emphasizes a modern idiom called "coroutines", rather than callbacks. Coroutines promise the best of two worlds: the efficiency of callbacks, but with a natural and robust coding style similar to synchronous programming.

In barely 30 minutes I live-code a Python 3 async framework. First, I show how an async framework uses non-blocking sockets, callbacks, and an event loop. This version of the framework is very efficient, but callbacks make a mess of the code. Therefore, I implement coroutines using Python generators and two classes called Future and Task, and update my little framework to use coroutines instead of callbacks.

The live-coding demo isn't just a magic trick: watch to see how simply a coroutine-based async framework can be implemented, and gain a deep understanding of this miraculous new programming idiom in the Python 3 standard library.

Although this video is the same material as my recent talk at PyGotham, I think my delivery in this video from Open Source Bridge is superior to my PyGotham performance.

If you want to know coroutines deeply, however, a hurried video isn't the way to do it. I have a page full of links for further study on Python coroutines, but my main advice is this: Spend an evening with the chapter Guido van Rossum and I wrote on the subject; you'll be fast friends by the end.