PyDocs

Nav

Python Runtime Services

isasyncgenfunction

inspect

function · Added in 3.6 (source)
  • isasyncgenfunction(object)
Return true if the object is an asynchronous generator function.

Asynchronous generator functions are defined with "async def"
syntax and have "yield" expressions in their body.
Changed in 3.8, 3.10.6, 3.13
  • 3.8: Functions wrapped in functools.partial() now return True if the wrapped function is an asynchronous generator function.
  • 3.10.6: Duck-typed function-like objects now return True if their code object has the CO_ASYNC_GENERATOR flag.
  • 3.13: Functions wrapped in functools.partialmethod() now return True if the wrapped function is a asynchronous generator function.
1 Example
>>> async def agen():
...     yield 1
...
>>> inspect.isasyncgenfunction(agen)
True
from the Python docs
See Also
No see-alsos for inspect/isasyncgenfunction
0 Notes
No notes for isasyncgenfunction