Skip to the workspace
Pebellslearn by building

Python syntax & reference

Find the form you need, compare how it behaves, and open the complete explanation when you need more depth.

Python 3.10+ syntax; individual entries identify newer features. Browser exercises use the configured Python runner.

1 matching syntax entry

Awaiting and scheduling

Learn in depth →

An async function call creates a coroutine. Awaiting or scheduling it arranges execution.

await operation()
asyncio.create_task(operation())
async with asyncio.TaskGroup() as group: ...

Example

import inspect
async def fetch():
    return 42
coroutine = fetch()
print(inspect.iscoroutine(coroutine))
coroutine.close()

Result

True

Watch for: Blocking calls still block an event-loop thread. Use cleanup in finally and normally re-raise cancellation after cleanup. TaskGroup needs Python 3.11+.

Practise this topic →
Complete explanation index (91 lessons indexed)

Multiprocessing and Asyncio

Technical sources and review date

Original Pebells examples. Reviewed 2026-10-28.

Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.