inspect.getcoroutinestate
Prev: inspect.getcoroutinelocals | Up: inspect | Next: inspect.getdoc
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.getcoroutinestate
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import getcoroutinestate
Signature & Overview
inspect.getcoroutinestate(coroutine)
Get current state of a coroutine object.
Usage
import inspect
async def job(): return 1
c = job()
assert inspect.getcoroutinestate(c) == inspect.CORO_CREATED
c.close()
assert inspect.getcoroutinestate(c) == inspect.CORO_CLOSED
Gotchas
- States:
CORO_CREATED,CORO_RUNNING,CORO_SUSPENDED,CORO_CLOSED.
REPL Inspect
from inspect import getcoroutinestate
help(getcoroutinestate)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/getcoroutinelocals Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/getdoc Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/inspect/ArgInfo Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Arguments Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Attribute Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BlockFinder Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BoundArguments shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BufferFlags shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClassFoundException shared tags: #inspect, #stdlib