On Mon, Nov 18, 2019 at 2:56 PM Daniel Zeng <daniel.z...@gmail.com> wrote: > > Syntax for tuple comprehension, something like: > (i, for i in range(10))
Is this meant to produce a tuple that contains inner tuples, or is it the same as tuple(i for i in range(10)) ? > This shouldn't result in ambiguity, since generators need to be in > parentheses anyway: > (i, for i in range(10)) vs (1, (i for i in range(10))) > Technically no, but it would be very confusing. (i for i in range(10)) # genexp (i, for i in range(10)) # your proposal ((i,) for i in range(10)) # genexp (i,1 for i in range(10)) # still error Is the comma just magic that says "tuple comprehension, not genexp"? ChrisA _______________________________________________ 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/LE7DPW75MDFOSDZI56ECSIWHXPC6BBSM/ Code of Conduct: http://python.org/psf/codeofconduct/