asyncio.iscoroutinefunction
Prev: asyncio.iscoroutine | Up: asyncio | Next: asyncio.isfuture
Rel: asyncio.AbstractEventLoop, asyncio.AbstractServer, asyncio.all_tasks, asyncio.as_completed
Ref: docs.python.org — asyncio.iscoroutinefunction
Tags: #public #python3 #stdlib #asyncio
Import
import asyncio
from asyncio import iscoroutinefunction
Signature & Overview
asyncio.iscoroutinefunction(func)
Return True if func is a decorated coroutine function.
Usage
import asyncio
async def fn(): return 1
assert asyncio.iscoroutinefunction(fn) is True
assert asyncio.iscoroutinefunction(len) is False
Gotchas
- Prefer
inspect.iscoroutinefunction()in Python 3.12+:asyncio.iscoroutinefunctionis deprecated in favor ofinspect.iscoroutinefunction.
REPL Inspect
from asyncio import iscoroutinefunction
help(iscoroutinefunction)
Linked from
Related notes
- tuts/python3/stdlib_module/asyncio/iscoroutine Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/isfuture Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/asyncio/AbstractEventLoop Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/AbstractServer Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/all_tasks Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/as_completed Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/Barrier shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseEventLoop shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseProtocol shared tags: #asyncio, #stdlib