except clause not catching IndexError
Sion Arrowsmith
siona at chiark.greenend.org.uk
Thu Feb 23 07:42:28 EST 2006
Steven D'Aprano <steve at REMOVEMEcyber.com.au> wrote:
>You mean to say that "except X,Y:" gives different
>results to "except (X,Y):"?
> [ ... ]
>And here I was thinking that commas make tuples, not
>brackets. What is happening here?
Similar kind of thing to what's happening here:
>>> print "Hello,", "world!"
Hello, world!
>>> print ("Hello", "world!")
('Hello', 'world!')
And for that matter foo(a, b) v. foo((a, b)). Commas make
tuples, but they're also argument separators, and if you're
using a tuple as an argument you need the brackets to
indicate precedence.
--
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list
mailing list