Runtime Types

types.CoroutineType — runtime type

Identifies native coroutine objects created by calling async def functions without yield. Calling the function creates a coroutine but does not run its body; await or asyncio.run drives it. A coroutine cannot normally be awaited twice. Close unused coroutine objects to avoid unawaited-coroutine warnings. Not every awaitable is this concrete type.

Formal Syntax & Structure

python syntaxpython
types.CoroutineType

Return Value

type

The class object types.CoroutineType; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
import types, asyncioasync def work(): return 7coro=work()print(isinstance(coro,types.CoroutineType))print(asyncio.run(coro))
Python Reference