[Async-sig] A possible tiny step towards event loop interoperability

Nathaniel Smith njs at pobox.com
Fri Jun 3 23:29:12 EDT 2016


On Fri, Jun 3, 2016 at 7:40 PM, Yury Selivanov <yselivanov at gmail.com> wrote:
>
>> On Jun 3, 2016, at 8:14 PM, Ben Darnell <ben at bendarnell.com> wrote:
>>
>> I think this could be useful, but's answering the question of "what coroutine runner is this", not "what event loop is this". It's already possible to stack one event loop on top of another so that the question of event loop is ambiguous, but any `async def` function or other coroutine has exactly one coroutine runner. The identity of the coroutine runner matters more in practice than the event loop (PEP 484 has standardized the event loop interface but left coroutine runners unspecified).
>
> Right, let’s discuss the hypothetical ‘await what_coroutine_runner_is_this()’.  Which, in case of asyncio, would return an instance of the current Task, right?

I guess what I was really thinking of was

  await what_api_does_this_coroutine_runner_implement()

so if you really needed to you could write code that does
asyncio-things on asyncio, curio-things on curio, etc., and the caller
doesn't have to care.

I'll emphasize again that this is a trivial tiny suggestion :-)

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Async-sig mailing list