"Nick Coghlan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | More completely: | | () # empty tuple | (1,) # 1 item tuple | (1,2) # 2 item tuple
1, # 1 item tuple, no parens needed, trailing comma mandatory 1,2 # 2 item tuple, no parens needed 1,2, # 2 item tuple with optional trailing comma The anomaly is the need for parens to denote an empty tuple since it is otherwise hard to tell a tuple nothing from a nothing nothing. The alternative would have been to use a bare trailing , ... but I guess Guido thought 'a = ,' and 'a == ,' would look odder than the current form, although it would have avoided the implication that parens rather than commas make tuples (other than the empty one). | - 1-tuples require a trailing comma to differentiate them from the use | of parentheses for mere expression grouping. 1-tuples require the trailing comma in order to have at least one around to differentiate them from bare expressions. Except for empty tuples, parens only need be added if they are indeed needed for expression grouping (which they often are because of precedence). tjr _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com