[Python-Dev] PEP 492: async/await in Python; version 5
yselivanov.ml at gmail.com
Wed May 6 19:30:52 CEST 2015
On 2015-05-06 12:05 AM, Ben Darnell wrote:
> On Tue, May 5, 2015 at 3:25 PM, Yury Selivanov <yselivanov.ml at gmail.com>
>> Yes, there is no other popular event loop for 3.4 other
>> than asyncio, that uses coroutines based on generators
>> (as far as I know).
> Tornado supports Python 3.4 and uses generator-based coroutines. We use
> `yield` instead of `yield from` for compatibility with Python 2. I have a
> patch to support the new async/await syntax here:
I don't know how this happened, especially since I've used
Tornado myself! It's amazing that Tornado will have support
of async/await when 3.5 is out!
> Overall, I like the PEP. I've been reluctant to embrace `yield from` for
> Tornado coroutines (Tornado's Futures do not implement `__iter__`) because
> I'm worried about confusion between `yield` and `yield from`, but async and
> await are explicit enough that that's not really a problem.
> My one request would be that there be a type or ABC corresponding to
> inspect.isawaitable(). Tornado uses functools.singledispatch to handle
> interoperability with other coroutine frameworks, so it would be best if we
> could distinguish awaitables from other objects in a way that is compatible
> with singledispatch. The patch above simply registers types.GeneratorType
> which isn't quite correct.
Sure. I'll add Awaitable and Coroutine ABCs.
More information about the Python-Dev