j: Next unread message
k: Previous unread message
j a: Jump to all threads
j l: Jump to MailingList overview
On 5/5/2015 2:48 PM, Guido van Rossum wrote:
If we're going through all of the effort to elevate await and async def to syntax, then can't the interpreter also be aware if it's running an event loop? Then, if we are running an event loop, await becomes "yield from", using the event loop. But if we're not running an event loop, then await becomes a blocking wait, using some version of run_until_complete, whether really from asyncio or baked into the interpreter.
This way, I can write my library code as being async, but it's still usable from non-async code (although it would need to be called with await, of course).
I'll admit I haven't thought this all the way through, and I'm still reading through PEP 492. But if I can write my async code as if it were blocking using await, why can't it really be blocking, too?