[Python-Dev] async/await in Python; v2

Paul Sokolovsky pmiscml at gmail.com
Thu Apr 23 12:35:54 CEST 2015


Hello,

On Thu, 23 Apr 2015 12:18:51 +0300
Andrew Svetlov <andrew.svetlov at gmail.com> wrote:

[]

> > 3.
> > async with and async for
> > Bead idea, we clutter the language even more and it is one more
> > thing every newbie could do wrong.
> > for x in y:
> >   result = await f()
> > is enough, every 'async' framework lived without it over years.
> 
> async for i in iterable:
>     pass
> 
> is not equal for
> 
> for fut in iterable:
>     i = yield from fut

But people who used Twisted all their life don't know that! They just
know that "async for" is not needed and bad.

I know I'm a bad guy to make such comments, too bad there's a bit of
truth in them, or everyone would just call me an a%$&ole right away.


Generally, I already provided feedback (on asyncio list) that asyncio
is based not on native Python concepts like a coroutine, but on
foreign concurrency concepts like callback or Future, and a coroutine
is fitted as a second-class citizen on top of that. I understand why
that was done - to not leave out all those twisteds from a shiny new
world of asyncio, but sometimes one may wonder if having a clear cut
would've helped (compat could then have been added as a clearly separate
subpackage, implemented in terms of coroutines). Now people coming from
non-coroutine frameworks who were promised compatibility see "bad"
things in asyncio (and related areas), and people lured by a promise of
native Python framework see bad things too.  


-- 
Best regards,
 Paul                          mailto:pmiscml at gmail.com


More information about the Python-Dev mailing list