Message265024
> Honestly I think it's pretty crazy and out there to have multiple event
loops in the same thread. That feels like an anti-pattern inspired by some
other event loop APIs (in other languages) that encourage this. But asyncio
was not designed for that.
I agree.
OTOH, if you're designing a library for asyncio, you want it to be as foolproof as possible, so many people simply pass an event loop everywhere. It's especially annoying when you have a huge chunk of code that didn't need the loop, and then when something needs it you have to refactor everything or use "get_event_loop".
In terms of performance, I don't think this is gonna affect anything, it's just a couple of additional thread-local sets in the Loop.run method.
And we can design "get_running_loop" to raise a clear exception if no loop is currently running. |
|
Date |
User |
Action |
Args |
2016-05-06 20:29:52 | yselivanov | set | recipients:
+ yselivanov, gvanrossum, vstinner, r.david.murray, Ilya.Kulakov |
2016-05-06 20:29:52 | yselivanov | set | messageid: <1462566592.56.0.446416543988.issue26969@psf.upfronthosting.co.za> |
2016-05-06 20:29:52 | yselivanov | link | issue26969 messages |
2016-05-06 20:29:52 | yselivanov | create | |
|