[Python-ideas] Make asyncio.get_event_loop a builtin

Yury Selivanov yselivanov.ml at gmail.com
Tue May 22 14:22:06 EDT 2018


On Tue, May 22, 2018 at 2:09 PM Terry Reedy <tjreedy at udel.edu> wrote:
[..]
> I like the idea of making coroutines easier and use.  It would make more
> sense to me to expose an eventloop class as a builtin, so that one would
> write

> eventloop().run_until_complete(hello)

> eventloop would not necessarily have to be exactly the same as the
> default returned by get_event_loop.  Would all the asyncio eventloop
> methods be needed?  For running coroutines, it would be even nicer to
write

> eventloop().run(hello)

We have asyncio.run() in 3.7:
https://docs.python.org/3.7/library/asyncio-task.html#asyncio.run  (event
loop can be customized via policy).

Yury


More information about the Python-ideas mailing list