Sign up for DUTC Weekly: https://mailchi.mp/dutc/ytweekly
LinkedIn: / do-n-t-use-this-code
Website: https://www.dontusethiscode.com/index...
Upcoming events: learning.dutc.io
Looking for training? Contact [email protected]
Unraveling the Mechanics of Asynchronous Code Execution in Python
Explore the inner workings of asyncio in Python and unravel the secrets of how await enables non-linear code execution. Discover the concept of function coloring and its impact on writing asynchronous code. Delve into the role of schedulers and gain explicit control over task execution.
In Python, the await keyword plays a crucial role in passing the control of execution to the callee, enabling non-linear execution flow. In this seminar, we will uncover the intricacies of how await works, highlighting its ability to yield control to other parts of the codebase, based on the scheduling decisions made by the underlying asyncio scheduler.
To better understand how asynchronous code compares to its synchronous counterpart, we will explore the metaphor of function coloring. This classification highlights the reality that async functions can call any function, but synchronous functions cannot call async ones. We will discuss the implications of this divide and its impact on writing and managing asynchronous code.
Furthermore, we will dive into the role of schedulers in asyncio, giving us explicit control over how code is executed and when. By understanding how schedulers facilitate efficient task scheduling and execution, we gain insight into optimizing the performance and responsiveness of our asynchronous applications.