PyDocs

Nav

Python Runtime Services

isgeneratorfunction

inspect

function (source)
  • isgeneratorfunction(object)
Return true if the object is a user-defined generator function.

Generator function objects provide the same attributes as functions.
See help(isfunction) for a list of attributes.
Changed in 3.8, 3.10.6, 3.13
  • 3.8: Functions wrapped in functools.partial() now return True if the wrapped function is a Python generator function.
  • 3.10.6: Duck-typed function-like objects now return True if their code object has the CO_GENERATOR flag.
  • 3.13: Functions wrapped in functools.partialmethod() now return True if the wrapped function is a Python generator function.
0 Examples
No examples for inspect/isgeneratorfunction.
See Also
No see-alsos for inspect/isgeneratorfunction
0 Notes
No notes for isgeneratorfunction