Re: [Python-Dev] Disallow ambiguous syntax f(x for x in [1],)

2017-11-13 Thread Ivan Levkivskyi
FWIW, it is common to have syntax checks in ast.c. Especially situations like class ``C(x for x in [1]): ...`` I think would be hard to prohibit in Grammar. Since anyway we have many checks in ast.c already, I wouldn't care much about implementing these corner cases in Grammar. -- Ivan ___

Re: [Python-Dev] Disallow ambiguous syntax f(x for x in [1],)

2017-11-12 Thread Serhiy Storchaka
13.11.17 02:00, Guido van Rossum пише: It's hard to keep those two in sync, since the actual Grammar file is constrained by being strictly LL(1)... Can you get someone else to review the implementation? I haven't change the grammar, just have changed checks in the CST to AST transformer. Mayb

Re: [Python-Dev] Disallow ambiguous syntax f(x for x in [1],)

2017-11-12 Thread Guido van Rossum
It's hard to keep those two in sync, since the actual Grammar file is constrained by being strictly LL(1)... Can you get someone else to review the implementation? ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/

Re: [Python-Dev] Disallow ambiguous syntax f(x for x in [1],)

2017-11-12 Thread Serhiy Storchaka
12.11.17 18:57, Guido van Rossum пише: Sounds good to me. Thanks! Here is an implementation: https://bugs.python.org/issue32012. I have found that formally trailing comma after generator expression is not allowed by the grammar defined in the language reference: call: `primary` "(" [`arg

Re: [Python-Dev] Disallow ambiguous syntax f(x for x in [1],)

2017-11-12 Thread Guido van Rossum
Sounds good to me. On Sun, Nov 12, 2017 at 7:17 AM, Serhiy Storchaka wrote: > Initially generator expressions always had to be written inside > parentheses, as documented in PEP 289 [1]. The additional parenthesis could > be omitted on calls with only one argument, because in this case the > gen

[Python-Dev] Disallow ambiguous syntax f(x for x in [1],)

2017-11-12 Thread Serhiy Storchaka
Initially generator expressions always had to be written inside parentheses, as documented in PEP 289 [1]. The additional parenthesis could be omitted on calls with only one argument, because in this case the generator expression already is written inside parentheses. You could write just `list