[issue39529] Deprecate get_event_loop()

Kyle Stanley report at bugs.python.org
Mon May 31 14:16:28 EDT 2021


Kyle Stanley <aeros167 at gmail.com> added the comment:

> But why does `asyncio.run` unconditionally create a new event loop instead of running on `asyncio.get_event_loop`? 

AFAIK, it does so for purposes of compatibility in programs that need multiple separate event loops and providing a degree of self-dependency. asyncio.run() is entirely self-reliant in that it creates all needed resources at the start and closes them in finalization, rather than depending on existing resources. I believe this to be significantly safer and better guaranteed to function as intended, although perhaps at some cost to convenience in cases like your own where there only needs to be one event loop.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39529>
_______________________________________


More information about the Python-bugs-list mailing list