[Python-checkins] cpython (3.6): docs/inspect: clarify iscoroutinefunction; add docs for isasyncgen*
yury.selivanov
python-checkins at python.org
Tue Nov 8 12:23:43 EST 2016
https://hg.python.org/cpython/rev/f7f89a4e047d
changeset: 104968:f7f89a4e047d
branch: 3.6
parent: 104966:f604b6ebd802
user: Yury Selivanov <yury at magic.io>
date: Tue Nov 08 12:23:09 2016 -0500
summary:
docs/inspect: clarify iscoroutinefunction; add docs for isasyncgen*
files:
Lib/inspect.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Lib/inspect.py b/Lib/inspect.py
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -179,17 +179,22 @@
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):
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list