The Tuple syntax is perfectly regular

Grant Edwards ge at nowhere.none
Mon Sep 4 18:07:17 EDT 2000


In article <slrn8r7p08.536.jepler.lnk at potty.housenet>, jepler epler wrote:
>'(', (item, ',')*, ')'
>
>()
>(1,)
>(1,2,)
>
>the only irregularity is that the trailing comma is sometimes optional.
>Surely everybody will be happy if we eliminate that little bit of cruft.

No, that's not the tuple syntax.  The syntax is:

      empty: ()
  singleton: a,
       etc.: a,b
           : a,b,c 

The parens are only part of tuple syntax in the case of the
empty touple.  You're right about an optional trailing comma on
tuples with 2+ items.

-- 
Grant Edwards                   grante             Yow!  I smell like a wet
                                  at               reducing clinic on Columbus
                               visi.com            Day!



More information about the Python-list mailing list