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

Mensanator mensanator at aol.com
Fri Aug 29 14:10:17 EDT 2008


On Aug 29, 10:11 am, Roy Smith <r... at panix.com> wrote:
> In article <QOCdnfa_yarxliXVnZ2dnUVZ_i2dn... at posted.visi>,
>  Grant Edwards <gra... at visi.com> wrote:
>
>
>
>
>
> > On 2008-08-29, Roy Smith <r... at panix.com> wrote:
>
> > > Exactly.  This is one of those little pieces of syntactic
> > > sugar which makes python so nice to work with.  The
> > > alternative is (in C, for example) abominations like this:
>
> > > const char* l[] = {"foo"
> > >                  , "bar"
> > >                  , "baz"
> > >                  };
>
> > > and even those are not quite as good because you still have to
> > > special-case the first entry.
>
> > It's probably a spec violation, but I've never seen a C
> > compiler that objected to a comma after the last item in an
> > initializer list.  (At least not at the warning levels I use,
> > which tend to be on the picky side.)
>
> 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").

That's the difference between a specification and
an implementation, isn't it?

>
> Still, I have seem people do that in code.- Hide quoted text -
>
> - Show quoted text -




More information about the Python-list mailing list