Summary
Asyncio is the standard library for managing cooperative concurrent and asynchronous tasks in Python. It requires that the tasks are awaitable objects (coroutines, futures, or objects that implement the __await__ method). The basic requirement is that the tasks you want to run in asyncio’s event loop are non-blocking. If you need it to execute a blocking operation, you have to use Python’s multithreading capabilities.
To use asyncio, you have to include the async/await keywords to create coroutines or implement the Awaitable interface and understand the consequences of their interaction. For the most part, you will be able to use asyncio’s capabilities without having to manipulate tasks or the event loop directly, but you can access low-level APIs to do so if needs be.
Alternative approaches to implementing highly performant concurrent tasks using asyncio libraries include uvloop, aiofiles, and aiohttp. Otherwise, an alternative way of implementing...