re-entering in the normal flow after an exception is raised

Michele Simionato michele.simionato at
Tue Sep 28 18:17:07 CEST 2004

I think I want "re-entrant exceptions" (not sure if this is the
correct name).

Consider the following example:

class NotSeriousException(Exception):

def do_this():
    raise NotSeriousException()

def do_that():

def do_this_and_that():

Since the exception is raised at the do_this() level, do_that() will
not be executed. However, since the exception is not that serious, I
would like to catch it and continue from the point the exception was
raised, i.e. something like that:

except NotSeriousException:
    continue # does not work of course

where "continue" would continue from do_that().

Is there some elegant or hackish way to get this? 
Notice that I do NOT want to modify the source code of
It comes from real life code and I could modify it, but if there was
smarter way of getting what I want I would be interested ...

          Michele Simionato

More information about the Python-list mailing list