[Python-Dev] PEP 492 vs. PEP 3152, new round
Guido van Rossum
guido at python.org
Wed Apr 29 04:00:55 CEST 2015
I don't care for await await x.
On Apr 28, 2015 6:53 PM, "Yury Selivanov" <yselivanov.ml at gmail.com> wrote:
> Looking at the grammar -- the only downside of the current approach is that
> you can't do 'await await fut'. I still think that it reads better with
> parens. If we put 'await' to 'factor' terminal we would allow
>
> await -fut # await (-fut)
>
> I think I something like
>
> power: atom_expr ['**' factor]
> atom_expr: [AWAIT] atom_expr | atom_trailer
> atom_trailer: atom trailer*
>
> will fix 'await await' situation, but does it really need to be fixed?
>
> Yury
>
>
>
> On 2015-04-27 9:44 AM, Yury Selivanov wrote:
>
>> Hi Greg,
>>
>> I don't want this: "await a() * b()" to be parsed, it's not meaningful.
>>
>> Likely you'll see "await await a()" only once in your life, so I'm fine
>> to use parens for it (moreover, I think it reads better with parens)
>>
>> Yury
>>
>>
>> On 2015-04-27 8:52 AM, Greg Ewing wrote:
>>
>>> Yury Selivanov wrote:
>>>
>>>> I've done some experiments with grammar, and it looks like
>>>> we indeed can parse await quite differently from yield. Three
>>>> different options:
>>>>
>>>
>>> You don't seem to have tried what I suggested, which is
>>> to make 'await' a unary operator with the same precedence
>>> as '-', i.e. replace
>>>
>>> factor: ('+'|'-'|'~') factor | power
>>>
>>> with
>>>
>>> factor: ('+'|'-'|'~'|'await') factor | power
>>>
>>> That would allow
>>>
>>> await a()
>>> res = await a() + await b()
>>> res = await await a()
>>> if await a(): pass
>>> return await a()
>>> print(await a())
>>> func(arg=await a())
>>> await a() * b()
>>>
>>>
>>
> _______________________________________________
> Python-Dev mailing list
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150428/894400a3/attachment.html>
More information about the Python-Dev
mailing list