[Python-ideas] async/await in Python

Brett Cannon brett at python.org
Sat Apr 18 15:40:36 CEST 2015


On Sat, Apr 18, 2015 at 5:53 AM Greg Ewing <greg.ewing at canterbury.ac.nz>
wrote:

> Yury Selivanov wrote:
> >
> > Here's my proposal to add async/await in Python.
>
> You've essentially reinvented PEP 3152 - Cofunctions.
>
> https://www.python.org/dev/peps/pep-3152/
>
> Here's a summary of the relationships between them:
>
> PEP 3152                  Nearest equivalent in Yury's PEP
> --------                  --------------------------------
>
> codef f(args):            async def f(args):
>
> cocall f(args)            await f(args)
>
> __cocall__                __await__
>
> costart()                 async_def()
>
> There is currently no equivalent of "async for" and
> "async with" in PEP 3152, but they could easily be added.
> I would probably spell them "cofor" and "cowith".
>
> As the author of PEP 3152 I'm obviously biased, but I
> think my spellings are more elegant and less disruptive
> to reading of the code.
>

I prefer Yury's spellings. The use of 'async' seems more obvious to me for
what the term(s) are meant to convey. It also has the side-effect of being
more obvious to people coming from other programming languages (I also
asked my wife what she thought A-S-Y-N-C meant and she figured out that it
meant "asynchronous" and she isn't a programmer).

My brain also keeps trying to make actual words out of "cofor" and "cowith"
unsuccessfully and just settles on gibberish and something to do with cows,
respectively.


> PEP 3152 is currently marked as deferred. Maybe it's
> time to revive it? If Yury's pep is to be considered,
> we ought to discuss the relative merits of the two.
>

Discussing differences in semantics makes sense if there are any.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150418/49eb7355/attachment-0001.html>


More information about the Python-ideas mailing list