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

asyncio.new_event_loop

Prev: asyncio.isfuture | Up: asyncio | Next: asyncio.open_connection
Rel: asyncio.AbstractEventLoop, asyncio.AbstractServer, asyncio.all_tasks, asyncio.as_completed
Ref: docs.python.org — asyncio.new_event_loop
Tags: #public #python3 #stdlib #asyncio


Import

import asyncio
from asyncio import new_event_loop

Signature & Overview

asyncio.new_event_loop()

Equivalent to calling get_event_loop_policy().new_event_loop().

Usage

import asyncio

loop = asyncio.new_event_loop()
try:
    assert loop.run_until_complete(asyncio.sleep(0, result="ok")) == "ok"
finally:
    loop.close()

Gotchas

REPL Inspect

from asyncio import new_event_loop
help(new_event_loop)

Linked from

Related notes