PyCon 2009: A Curious Course on Coroutines and Concurrency (Part 2 of 3)
A Curious Course on Coroutines and Concurrency (part 2 of 3)
Presented at PyCon 2009 by David Beazley
If you are a programmer who cares about Python and concurrency, then you should also care about Python coroutines. Although they were first introduced in Python 2.5, coroutines remain one of Python's most overlooked features--- often vaguely described as a curious "extension" of generator functions with little insight as to how they might be applied to real-world problems. This tutorial examines coroutines in a more practical light by showing how they are actually a very elegant way to implement a processing "task." Using this task abstraction, it is possible to use coroutines to implement processing pipelines, event handling systems, and programs based on cooperative multitasking. Moreover, if you define tasks using coroutines, they can be easily incorporated into more traditional concurrent programs that utilize threads or message passing.
[VIDEO HAS ISSUES: bit of clipping start to finish.]