Lie wrote: > PPS: Actually, what makes a tuple is both the parens and the comma, > 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 harmless little case > gives error if done without the double parens, but what would happen > if we exchange the str into a function that accepts one argument and > several optional arguments (or better yet, one argument and an > optional * argument)?
I think the effect there is operator precedence. In str(a,b,c) the function-calling operator () takes over, and the commas are considered as argument separators. In str ((a,b,c)) the inner parens present a single tuple-expression to the function-calling operator. Just like a+b/c as against (a+b)/c but with esoteric overloading of ( ) and , . Mel. -- http://mail.python.org/mailman/listinfo/python-list