Hi! I'm the author of this post. I've been writing asynchronous Python code with async/await for quite a while but didn't have a perfect understanding of how it actually works: what await does; what an event loop really is and how it runs coroutines; what coroutines are; why Python has native coroutines as well as generator-based coroutines; how asyncio works; and so forth... In this post I've tried to answer all these questions. After reading it, you should be able to reason about async/await code almost as easily as you reason about regular Python code.
Interesting to see this language feature being broken down in python. Just today I was looking at async/await & generator in js (and wrote a summary here https://stackoverflow.com/a/69055066 while still trying to wrap my head around redux-saga https://redux-saga.js.org/)
Haven’t done python for a while; was ‘t aware js & python share such resemblances!
Side note: I've been desperately looking for a simple, clear and practical "getting started" guide of async/await in python. Any link you can recommend?
If you liked this post, you may also like other posts in my Python behind the scenes series: https://tenthousandmeters.com/tag/python-behind-the-scenes/
As always, I welcome your feedback and questions. Thanks!