[Python-Dev] PEP 492: No new syntax is required

Mark Shannon mark at hotpy.org
Mon Apr 27 09:48:49 CEST 2015



On 27/04/15 00:13, Guido van Rossum wrote:
> But new syntax is the whole point of the PEP. I want to be able to
> *syntactically* tell where the suspension points are in coroutines.
Doesn't "yield from" already do that?

> Currently this means looking for yield [from]; PEP 492 just adds looking
> for await and async [for|with]. Making await() a function defeats the
> purpose because now aliasing can hide its presence, and we're back in
> the land of gevent or stackless (where *anything* can potentially
> suspend the current task). I don't want to live in that land.
I don't think I was clear enough. I said that "await" *is* a function, 
not that is should be disguised as one. Reading the code, 
"GetAwaitableIter" would be a better name for that element of the 
implementation. It is a straightforward non-blocking function.

>
> On Sun, Apr 26, 2015 at 1:21 PM, Mark Shannon <mark at hotpy.org
> <mailto:mark at hotpy.org>> wrote:
>
>     Hi,
>
>     I was looking at PEP 492 and it seems to me that no new syntax is
>     required.
>
>     Looking at the code, it does four things; all of which, or a
>     functional equivalent, could be done with no new syntax.
>     1. Make a normal function into a generator or coroutine. This can be
>     done with a decorator.
>     2. Support a parallel set of special methods starting with 'a' or
>     'async'. Why not just use the current set of special methods?
>     3. "await". "await" is an operator that takes one argument and
>     produces a single result, without altering flow control and can thus
>     be replaced by an function.
>     4. Asynchronous with statement. The PEP lists the equivalent as
>     "with (yield from xxx)" which doesn't seem so bad.
>
>     Please don't add unnecessary new syntax.
>
>     Cheers,
>     Mark.
>
>     P.S. I'm not objecting to any of the other new features proposed,
>     just the new syntax.
>     _______________________________________________
>     Python-Dev mailing list
>     Python-Dev at python.org <mailto:Python-Dev at python.org>
>     https://mail.python.org/mailman/listinfo/python-dev
>     Unsubscribe:
>     https://mail.python.org/mailman/options/python-dev/guido%40python.org
>
>
>
>
> --
> --Guido van Rossum (python.org/~guido <http://python.org/~guido>)


More information about the Python-Dev mailing list