]> granicus.if.org Git - python/commitdiff
docs/inspect: clarify iscoroutinefunction; add docs for isasyncgen*
authorYury Selivanov <yury@magic.io>
Tue, 8 Nov 2016 17:23:09 +0000 (12:23 -0500)
committerYury Selivanov <yury@magic.io>
Tue, 8 Nov 2016 17:23:09 +0000 (12:23 -0500)
Lib/inspect.py

index 2923d6dacca03ceab35e7383cbb9a78b3c570159..f01dd1de5d67f76f9334edce54f8d40462b1f148 100644 (file)
@@ -179,17 +179,22 @@ def isgeneratorfunction(object):
 def iscoroutinefunction(object):
     """Return true if the object is a coroutine function.
 
-    Coroutine functions are defined with "async def" syntax,
-    or generators decorated with "types.coroutine".
+    Coroutine functions are defined with "async def" syntax.
     """
     return bool((isfunction(object) or ismethod(object)) and
                 object.__code__.co_flags & CO_COROUTINE)
 
 def 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.
+    """
     return bool((isfunction(object) or ismethod(object)) and
                 object.__code__.co_flags & CO_ASYNC_GENERATOR)
 
 def isasyncgen(object):
+    """Return true if the object is an asynchronous generator."""
     return isinstance(object, types.AsyncGeneratorType)
 
 def isgenerator(object):