Parens do create a tuple

Chris Angelico rosuav at gmail.com
Sun Apr 10 21:51:34 EDT 2016


On Mon, Apr 11, 2016 at 11:41 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
>> I'd rather be correct on the one-element case and wrong on the empty
>> than the other way around.
>
> To say “commas create tuples” is to say an unobjectionably true
> statement about Python syntax. It remains true as one continues to learn
> Python.
>
> To say “parens do not create tuples” is to lay a trap which needs to be
> de-fused at some point. Better IMO never to lay that trap.

Fair. "Commas create tuples" is correct but incomplete; "parens do not
create tuples" is incorrect in a narrow way. Fortunately, technical
correctness lines up with the more useful case of helping people
understand the one-element case.

ChrisA



More information about the Python-list mailing list