[Python-ideas] async/await in Python

Yury Selivanov yselivanov.ml at gmail.com
Sat Apr 18 07:31:06 CEST 2015


Hi Dan,

On 2015-04-17 9:31 PM, Dan O'Reilly wrote:
> This is exciting! I expect this will eliminate some of the confusion I see
> from new users of asyncio on StackOverflow.

Thanks!  I'm sure it will!
>
> I'm curious about what this means for asyncio best practices from 3.5
> onward, though. Is the use of @asyncio.coroutine/yield from being
> deprecated in asyncio once this feature is added? I guess anyone that needs
> to write backwards compatible code would need to continue using the old
> way, so perhaps not yet?
Definitely not yet.  I expect libraries to start offering extended
functionality (like nice context managers and iterators) for those
who can use async/await, but to keep backwards compatibility until
3.6 at least.

> At the very least the docs should probably mention
> that the async/wait syntax is available/preferred for code that only needs
> to support 3.5+. If you're going the deprecation route, the docs should be
> updated to use async/await, and probably just include a note stating that
> the old @asyncio.coroutine/yield from method is required to support 3.4 and
> lower.

This is something that we definitely have to consider if the PEP
gets accepted.

Best,
Yury


More information about the Python-ideas mailing list