[1,2,3] exactly same as [1,2,3,] ?

Fredrik Lundh fredrik at pythonware.com
Sat Aug 30 11:04:44 EDT 2008


Roy Smith wrote:

> Yowza, you're right (at least for the one case I tried).  This must be a 
> new development (where "new development" is defined as, "It wasn't legal in 
> the original K&R C I learned when I was a pup").

the C 89 grammar appears to be:

     initializer:
         assignment-expression
         { initializer-list }
         { initializer-list , }

     initializer-list:
         designation-opt initializer
         initializer-list , designation-opt initializer

so a trailing comma has been allowed for around twenty years.

</F>




More information about the Python-list mailing list