exception message output problem

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Sat Dec 22 16:30:13 EST 2007


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.



More information about the Python-list mailing list