Message394821
> 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. |
|
Date |
User |
Action |
Args |
2021-05-31 18:16:28 | aeros | set | recipients:
+ aeros, asvetlov, Ben.Darnell, serhiy.storchaka, yselivanov, xtreak |
2021-05-31 18:16:28 | aeros | set | messageid: <1622484988.28.0.313159746734.issue39529@roundup.psfhosted.org> |
2021-05-31 18:16:28 | aeros | link | issue39529 messages |
2021-05-31 18:16:28 | aeros | create | |
|