Why tuple with one item is no tuple

Paddy paddy3118 at netscape.net
Tue Mar 15 13:33:21 EST 2005


Hmm,
going 'the other way', you are allowed an extra , but you can't have
(,) as the empty tuple.:

>>> (1,2,)
(1, 2)
>>> (1,)
(1,)
>>> (,)
...
Traceback (  File "<interactive input>", line 1
    (,)
     ^
SyntaxError: invalid syntax


-- Pad.




More information about the Python-list mailing list