⚙️ Advanced Python
Async/Await & Concurrency
Asyncio enables non-blocking I/O in a single thread. This section provides a textbook deep dive into coroutines and event loops.
● Advanced
📖 Based on: Python Documentation — asyncio
📋 Table of Contents
1 · Coroutines
Textbook Definition
"Coroutines are a more generalized form of subroutines. Subroutines are entered at one point and exited at another point. Coroutines can be entered, exited, and resumed at many different points." — Python Docs
2 · Return Value: async def
🔁 Return Value
Calling an async def function does not execute it. It returns a coroutine object. To actually run the code, the coroutine must be scheduled on an event loop (e.g., via await or asyncio.run()).