asyncio.set_event_loop_policy
Prev: asyncio.set_event_loop | Up: asyncio | Next: asyncio.shield
Rel: asyncio.AbstractEventLoop, asyncio.AbstractServer, asyncio.all_tasks, asyncio.as_completed
Ref: docs.python.org — asyncio.set_event_loop_policy
Tags: #public #python3 #stdlib #asyncio
Import
import asyncio
from asyncio import set_event_loop_policy
Signature & Overview
asyncio.set_event_loop_policy(policy)
asyncio.set_event_loop_policy() function.
Usage
import asyncio
# Legacy global policy setter; deprecated in Python 3.14+
assert callable(asyncio.set_event_loop_policy)
Gotchas
- Prefer
asyncio.run(main(), loop_factory=...): Global policies affect the entire process and are deprecated in Python 3.14+.
REPL Inspect
from asyncio import set_event_loop_policy
help(set_event_loop_policy)
Linked from
Related notes
- tuts/python3/stdlib_module/asyncio/set_event_loop Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/shield 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