[Python-ideas] async/await in Python

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 18 02:21:36 CEST 2015


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.

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.

-- 
Greg


More information about the Python-ideas mailing list