Multiple exception syntax

Peter Otten __peter__ at
Fri Jan 2 10:48:52 CET 2004

Pierre Quentel wrote:

> I find this confusing. It would be clearer for me to have :
> "except Error1 or Error2 or Error3"

I see the ambiguity, but I find the above confusing, too, because it looks
like a boolean expression, which it is not. I'd rather change the syntax to
clearly separate the tuple of exception classes from the target:

"except" [expression ["to" target]] ":" suite

"to" is currently a comma. Don't expect that to happen, though.

By the way, I don't recall having seen expression containing exception
*instances*, and only learned that this is possible when I looked up the
try statement in the reference. Is this for string exceptions or has it an
application in newer code?

> Or have I drunk too much lately ?

Obviously, if you have to ask :-)


More information about the Python-list mailing list