Steven D'Aprano <[EMAIL PROTECTED]> wrote: > And here I was thinking that commas make tuples, not > brackets. What is happening here?
What is happening is that the syntax for forming tuples is one of Python's warts. Sometimes the comma is what makes a tuple: >>> a = 1, 2 >>> type (a) <type 'tuple'> Sometimes, it is the parens: >>> b = () >>> type (b) <type 'tuple'> Sometimes the syntax is ambiguous and you need both. This happens anytime you have a list of comma separated things, such as in the arguments to a function: a = foo (1, 2) # two integer arguments b = foo ((a, 2)) # one tuple argument The except clause of a try statement is one of those times. -- http://mail.python.org/mailman/listinfo/python-list