I'm researching the asyncio library and I cannot understand completely the reason behind event loop policies.
So far it's clear that this interface is a factory that returns event loop for current context. The definition of the context is not clear though. Apparently, the interface of asyncio.AbstractEventLoopPolicy assumes that concrete implementation will be able to extract context on its own because neither method accepts arguments. This model works well for the event-loop-per-thread default policy, but usage under more sophisticated circumstances are under the question.
Looks like context isn't an arbitrary entity, but should follow certain rules (e.g. being visible globally). I wonder if such rules are listed anywhere. Are there examples of custom policies around?
aiogeventandgblubboth have custom EventLoopPolicys. It seems to be most commonly used in libraries that integrateasynciowith other event loops.