On 26 April 2015 at 06:18, Yury Selivanov <yselivanov...@gmail.com> wrote:
> Option #3. Create a new terminal for await expression between
> 'atom' and 'power'.
>
> Required grammar changes:
> https://gist.github.com/1st1/cb0bd257b04adb87e167#file-option-3-patch
>
> Repo to play with (parser module is broken atm):
> https://github.com/1st1/cpython/tree/await_noparens2
>
> Syntax:
>
>   await a()
>   res = await a() + await b()
>   res = await (await a()) # invalid syntax w/o parens
>   if await a(): pass
>   return await a()
>   print(await a())
>   func(arg=await a())
>   await (a() * b()) # w/o parens '(await a() * b())
>
> I think that Option #3 is a clear winner.

Very nice!

How would the following statements parse with this option?

    res = await a(), b()
    res = [await a(), b()]
    with await a(), b: pass
    f(await a(), b)

I think it's OK if these end up requiring parentheses in order to do
the right thing (as that will be helpful for humans regardless), but
the PEP should be clear as to whether or not they do:

    res = (await a()), b()
    res = [(await a()), b()]
    with (await a()), b: pass
    f((await a()), b)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to