Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cc61181b
Commit
cc61181b
authored
Nov 08, 2016
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs/inspect: clarify iscoroutinefunction; add docs for isasyncgen*
parent
31d9ed28
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
Lib/inspect.py
Lib/inspect.py
+7
-2
No files found.
Lib/inspect.py
View file @
cc61181b
...
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment