On Dec 23, 4:30 am, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> Lie a écrit :
>
> > PPS: Actually, what makes a tuple is both the parens and the comma,
>
> Nope, it's definively the comma. You can check the language's grammar,
> it's part of the doc. Or just test FWIW:
>
> Python 2.4.3 (#1, Mar 12 2007, 23:32:01)
> [GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)] on
> linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> a = 1,
>  >>> type(a)
> <type 'tuple'>
>  >>>
>
> > with comma as the minimum signifier, inspect this: "str(a) +
> > str((a,b,c))", you have to use the double parens, one to make the
> > tuple and the other as part of the str.
>
> This is a problem of operator precedence.

I think some people have misunderstood me, I know parens isn't a
formal definition for tuples, but it's more or less a de facto
grammar, as it is hard to create parens-less tuples without the
interpreter mistaking it for other things, except for a few cases.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to