Asyncio -- delayed calculation

Chris Angelico rosuav at gmail.com
Tue Nov 29 00:42:44 EST 2016


On Tue, Nov 29, 2016 at 4:13 PM, Paul Rubin <no.email at nospam.invalid> wrote:
>
> I haven't gotten my head around Python asyncio and have been wanting
> to read this:
>
>    http://lucumr.pocoo.org/2016/10/30/i-dont-understand-asyncio/

It's talking a lot about how we got here, which isn't all necessary if
you just want to give asyncio a whirl. The conclusion at the end says
that you should just use 'async def' and not bother with all the older
forms, which I agree with (subject to the usual caveat that this
implies no support for older Pythons).

There's one thing that I really struggle with, though, and that's that
there's no easy and obvious way to demonstrate the lowest level of
operation. If "await x()" is like "yield from x()", how do you do the
innermost "yield" that actually does something? I have the same
confusion with Node.js, too. It's as if async primitives can't be
implemented in application code at all, they just have to be given to
you. Certainly it's not something made clear anywhere in the docs that
I've found.

ChrisA



More information about the Python-list mailing list