Asynchronous programming
Asynchronous programming makes processing a lot faster as more than one task executes in parallel to the main thread. A Python library that is very commonly used in asynchronous programming is asyncio. For asynchronous programming, you need an event loop that schedules asynchronous tasks, that is, the event loop picks up a task that is waiting in a queue for processing. Functions that need to be run asynchronously need to be prefixed with the async keyword.
The functions that will be executed asynchronously are marked with the async keyword. The event loop recognizes the asynchronous function through the async prefix. All asynchronous functions are known as coroutine. Any asynchronous function (coroutine) after starting ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access