Re: [Python-Dev] Using async/await in place of yield expression

2017年11月27日 01:16:38 -0800

On 2017年11月27日 00:41:55 -0800
Nathaniel Smith <[email protected]> wrote:
> 
> Since most libraries assume that they control both __await__ and the
> coroutine runner, they don't tend to give great error messages here
> (though trio does [2] ;-)). I think this is also why the asyncio docs
> don't talk about this. I guess in asyncio's case it is technically a
> semi-public API because you need to know how it works if you're the
> author of a library like tornado or twisted that wants to integrate
> with asyncio. But most people aren't the authors of tornado or
> twisted, and the ones who are already know how this works, so the lack
> of docs isn't a huge deal in practice...
This does seem to mean that it can be difficult to provide a __await__
method that works with different coroutine runners, though. For
example, Tornado Futures implement __await__ for compatibility with the
asyncio event loop. But what if Tornado wants to make its Future class
compatible with an event loop that requires a different __await__
convention?
Regards
Antoine.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to