Tuple Format?

Moshe Zadka moshez at math.huji.ac.il
Fri Sep 1 13:25:49 CEST 2000

On Thu, 31 Aug 2000, Gene C wrote:

> Has anyone considered a different format for tuples to get around the
> somewhat strange single element tuple format? I find when explaining the
> language to others, the single tuple format always solicits a, "Thats
> weird."

That's because you're not explaining it correctly. Paraphrasing the NRA,
"parens don't build tuples, commas build tuples". Parens serve only
the purpose of disambiguating. Now,

"1" is a number
"1, 2," is a tuple.
The last comma is optional, so
"1, 2" is a tuple too.
There is only one case where the comma isn't optional: where it would
otherwise cause an ambiguty
Moshe Zadka <moshez at math.huji.ac.il>
There is no IGLU cabal.

More information about the Python-list mailing list