The asyncio (https://docs.python.org/3/library/asyncio.html) library, which was originally an experiment called Tulip run by Guido, provides all the infrastructure to build asynchronous programs based on an event loop.
The library predates the introduction of async
, await
, and native coroutines in the language.
The asyncio
library is inspired by Twisted, and offers classes that mimic Twisted transports and protocols. Building a network application based on these consists of combining a transport class (like TCP) and a protocol class (such as HTTP), and using callbacks to orchestrate the execution of the various parts.
But, with the introduction of native coroutines, callback-style programming is less appealing, since it's much more readable to orchestrate the execution order via await
calls. You can use coroutine with asyncio
protocol and transport classes, but the original design was not meant for that and requires a bit of extra work.
However, the central feature is the...