On this page
  1. asyncio.set_event_loop
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

asyncio.set_event_loop

Prev: asyncio.run_coroutine_threadsafe | Up: asyncio | Next: asyncio.set_event_loop_policy
Rel: asyncio.AbstractEventLoop, asyncio.AbstractServer, asyncio.all_tasks, asyncio.as_completed
Ref: docs.python.org — asyncio.set_event_loop
Tags: #public #python3 #stdlib #asyncio


Import

import asyncio
from asyncio import set_event_loop

Signature & Overview

asyncio.set_event_loop(loop)

Equivalent to calling get_event_loop_policy().set_event_loop(loop).

Usage

import asyncio

# Legacy API for binding a loop to the current thread; prefer asyncio.run()
assert callable(asyncio.set_event_loop)

Gotchas

REPL Inspect

from asyncio import set_event_loop
help(set_event_loop)

Linked from

Related notes