AI engineering glossary · Python advanced

What is coroutine?

Coroutine: A function defined with async def whose execution can be paused and resumed. Calling it returns a coroutine object that does nothing until awaited or scheduled on an event loop.

Level: advancedTopic: Python advanced

Coroutine: an example

c = fetch(url) only creates a coroutine object; await c or asyncio.run(c) actually runs it.

Related terms

More Python advanced terms

Where you learn it

Coroutine is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.