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 -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/QALANGWSXY2TVBCPFJLFLVEKXSJYGPYD/
Code of Conduct: http://python.org/psf/codeofconduct/