What is the difference between async def and regular functions?

This tests async def call semantics. A strong answer contrasts regular functions, which execute immediately, with async def, which returns a coroutine object that does nothing until awaited or wrapped in create_task.
This tests your understanding of Python asyncio call semantics. A strong answer first clarifies that a regular function executes immediately, while calling an async def returns a coroutine object without running the body. Second, it explains that this awaitable must be driven by the event loop via await, create_task, or asyncio.run. Third, it notes that calling without await or create_task leaves the coroutine unscheduled, so it never runs and CPython raises a RuntimeWarning.
Read the original → docs.python.org
- #python
- #asyncio
- #coroutines
- #interview
- #beginner
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.