On Fri, Jun 18, 2021 at 07:38:49AM -0700, Guido van Rossum wrote:

> Note the ambiguity around whether the user might have meant
> 
>     [x,(y for y in a)]
> 
> or
> 
>     [(x, y) for y in a]

We already have a rule to disambiguate generator comprehensions: they 
must always be parenthesized unless they are already parenthised:

    g = (y for y in a)  # parens required
    t = 999, (y for y in a)  # parens required

    func((y for y in a))  # inner parens optional


> That’s a good enough reason for me to also disallow *chunks.

That's an odd way to look at it. We must disallow an unambiguous syntax 
because a completely different syntax would have been ambiguous if we 
didn't already have a rule in place that disambiguates it.


-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/QALANGWSXY2TVBCPFJLFLVEKXSJYGPYD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to