diff options
author | Yury Selivanov <yury@magic.io> | 2016-11-08 17:23:26 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-11-08 17:23:26 (GMT) |
commit | 122b99dad472440dc7ec8857652794255e42810f (patch) | |
tree | 501c2f384a63ba3a2e0372623f32de432ab92d70 /Lib | |
parent | e83a64164ef20b0e15ad1f6b259cbe4e0a29be07 (diff) | |
parent | 4778e13148ea8aa3c64fb264e2d03dbacc399991 (diff) | |
download | cpython-122b99dad472440dc7ec8857652794255e42810f.zip cpython-122b99dad472440dc7ec8857652794255e42810f.tar.gz cpython-122b99dad472440dc7ec8857652794255e42810f.tar.bz2 |
Merge 3.6 (docs/inspect)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/inspect.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 2923d6d..f01dd1d 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -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): |