Tuple Format?

Alex Martelli aleaxit at yahoo.com
Sat Sep 2 06:10:34 EDT 2000


"Moshe Zadka" <moshez at math.huji.ac.il> wrote in message
news:Pine.GSO.4.10.10009020931130.4823-100000 at sundial...
    [snip]
> > What about ()?
> >
> > It's a tuple, but there are no commas, only parens.
>
> Right you are! This is the special case, not the 1-element tuple.

I disagree.  For any N, an N-element tuple is normally
written with N-1 commas.

Except for N==0, where N (0) commas are required; and
N==1, where N (1) commas are required.  So, 0 and 1 are
both special-cases in this sense.

An N-element tuple *may* be written with N commas
(putting an 'extra' one after the last element).  If N is
0 or 1, the N-element tuple *must* be written with N
commas.


Alex






More information about the Python-list mailing list