© Mohamed Mustapha Tahrioui 2019
M. M. Tahriouiasyncio Recipeshttps://doi.org/10.1007/978-1-4842-4401-2_2

2. Working with Event Loops

Mohamed Mustapha Tahrioui1 
(1)
Darmstadt, Hessen, Germany
 
Python version 3.4 has adopted a powerful framework to support concurrent execution of code: asyncio. This framework uses event loops to orchestrate the callbacks and asynchronous tasks. Event loops live in the context of event loop policies—a concept singular to asyncio. The interplay among coroutines, event loops, and policies is illustrated in Figure 2-1.
../images/470771_1_En_2_Chapter/470771_1_En_2_Fig1_HTML.jpg
Figure 2-1

Coroutines, event loops, and policies

Coroutines can be thought of as functions you can “pause” ...

Get asyncio Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.