Links: 108 Python Index
- Asyncio is designed to allow you to structure your code so that when one piece of linear single-threaded code (called a "coroutine") is waiting for something to happen another can take over and use the CPU.
- It’s not about using multiple cores, it’s about using a single core more efficiently
- In python to execute async functions we need to start the event loop.
- Use asyncio over threading if you have a library that is non blocking in nature.
- For example if you want to use asyncio for making requests then you will have to use libraries like httpx or iohttp we cannot use requests since it is blocking in nature.
- If we want to use requests then we will have to use threading.
- Python Asyncio Part 1 – Basic Concepts and Patterns | cloudfit-public-docs (bbc.github.io)
- Diagnose slow Python code. (Feat. async/await) - YouTube: Profiling and finding where asynio can be used.
- Asyncio: Understanding Async / Await in Python - YouTube
Last updated: 2022-11-11