New submission from Yury Selivanov <yseliva...@gmail.com>:

There's a fairly extensive discussion here: 
https://github.com/python/asyncio/pull/465

In short, asyncio.run() is a pretty straightforward addition, so let's add it.

The discussion was more focused on the asyncio.run_forever() proposal.  I now 
think that it shouldn't be implemented in asyncio.  Instead we should fix cases 
where 'loop.run_forever' is usually required.  Mainly that's servers, and they 
are easily fixable by making "Server" an async context manager and implementing 
a "server.serve_forever()" method.  That way, with asyncio.run():

    async def serve_something():
       async with asyncio.start_server(...) as server:
           await server.serve_forever()

    asyncio.run(serve_something())  # No loop.run_forever()!

----------
assignee: yselivanov
components: asyncio
messages: 308256
nosy: asvetlov, lukasz.langa, yselivanov
priority: normal
severity: normal
status: open
title: Implement asyncio.run()
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32314>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to