On Feb 12, 7:02 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > > Ben Finney wrote: > > [...] > > > > Note that '()' is syntactically null. Parentheses don't declare a > > > tuple literal, commas do. Parentheses are for grouping within > > > expressions, not specifying type. > > > Tell that to the interpreter: > > > >>> type(()) > > <type 'tuple'> > > >>> tuple() is () > > True > > Well, knock me down with a kipper. > > That makes it even more a violation of principle-of-least-astonishment > that the '(foo)' form doesn't give a one-element tuple literal.
The reason being, of course, that in this case '(1+2) * 3' would give a result several orders of magnitude more astonishing, so it's well worth the slight inconvenience of one-element tuples. George -- http://mail.python.org/mailman/listinfo/python-list