Summary
In this chapter, we have seen:
- The basic concepts of
asyncio
and how they interact - How to run external processes using
asyncio
- How to create a server and client using
asyncio
- How to create context managers with
asyncio
- How to create generators with
asyncio
- How to debug common issues when using
asyncio
- How to avoid the unfinished task pitfall
By now you should know how to keep your main loop responsive while waiting for results without having to resort to polling. In Chapter 14, Multiprocessing – When a Single CPU Core Is Not Enough, we will learn about threading
and multiprocessing
as an asyncio
alternative to running multiple functions in parallel.
For new projects, I would strongly consider using asyncio
from the ground up because it is usually the fastest solution for handling external resources. For existing scripts, however, this can be a very invasive process. So knowing about threading
and multiprocessing...