arbitrary exception handlers

graham.matthews@maths.anu.edu.au
21 Feb 1995 23:28:49 GMT

At present it seems I can only catch an exception if I do something
like this

try:
a_statement_that_might_cause_exception_E
except E:
...

When I would really like to set up a catcher like this,

on except E do
...

lots_of_statements_any_one_of_which_may_cause_exception_E

Is there any way to do this in Python - to set up a kind of global
exception catcher. Note that I cannot do something like,

try:
lots_of_statements_any_one_of_which_may_cause_exception_E
except E:
...

because some of the statements are in different modules/classes to
the others.

graham

--
                      Je suis pour le communisme
                      Je suis pour le socialisme
                      Je suis pour le capitalisme
                     Parce que je suis opportuniste