This is a somewhat unusual talk in structure, but it covers the basic theory of operation that underlies the UniversalQueue class in the Curio project. For the uninitiated, UniversalQueue allows seamless queuing between threads and asynchronous tasks using the same API as normal queues. Thus, you can have consumers and producers implemented in any combination of async or threaded code. It allows you mix things up in very interesting ways. Personally, I think it might be the most interesting part of Curio.
This talk is only meant to whet the appetite for learning more. The Curio project expands this idea much further than what is covered, but you’ll have to discover that for yourself.
You will note that Curio is never mentioned in the talk–in fact, I build the queue on top of asyncio instead. This is intentional–I think the ideas in the talk are more than just some “neat trick” that appears in a specific library. Thus, I wanted to ground it the standard library and standard Python.