Dev Helpers

Python / Async and concurrency

Run an async function

Dev Helpers · December 5, 2026

An async function call creates a coroutine. A top-level runner supplies the event loop that executes it.

Worked example

import asyncio
async def main():
    return 'ready'
print(asyncio.run(main()))

Result

ready

Implementation notes

Blocking work inside the coroutine still blocks its event loop. Scheduling the coroutine correctly does not automatically make a synchronous operation concurrent.

Try it yourself

In an already-running async context, await the coroutine directly.

Open the Python example →

Editorial date December 5, 2026 · Published December 6, 2026

Related articles

Transpose a matrix

Transposing rows into columns assumes a decision about uneven rows. Ordinary zip stops at the shortest input.

Unpack with a remainder

Starred unpacking separates a fixed header from a variable-length tail. It still requires enough elements for the fixed positions.

Use quotient and remainder

A page number and offset are the quotient and remainder of the same division. divmod returns both from one operation.