This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients asvetlov, lukasz.langa, yselivanov
Date 2017-12-13.21:47:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513201628.59.0.213398074469.issue32314@psf.upfronthosting.co.za>
In-reply-to
Content
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()!
History
Date User Action Args
2017-12-13 21:47:08yselivanovsetrecipients: + yselivanov, asvetlov, lukasz.langa
2017-12-13 21:47:08yselivanovsetmessageid: <1513201628.59.0.213398074469.issue32314@psf.upfronthosting.co.za>
2017-12-13 21:47:08yselivanovlinkissue32314 messages
2017-12-13 21:47:08yselivanovcreate