_conditionally_ returning to point where exception was raised?

MackS mackstevenson at hotmail.com
Wed Mar 16 12:53:11 EST 2005


Hi

I'm new to Python and would like to know if the following is possible.

Say I have one lower-level object A and one user-interface object B.
Suppose B.CallingMethod() calls A.CalledMethod(), the latter method
stumbles upon an IO error and raises an exception. The calling method
detects the exception, but needs to get input from the user before
deciding whether A.CalledMethod() should continue being executed or
permantently stop/cancel the execution of the remaining code in
A.CalledMethod(). Can this be done?

What I would like to know is if the calling method is allowed to
"decide" (at run-time) whether or not the execution of the called
method resumes. Until now I only see two possibilities: either the
caller is coded in a way that it handles the exception and execution of
the called method resumes at the point where the exception was raised
or the caller was written in a way that doesn't handle it and the
program is stopped by the interpreter. Is there a third way, ie is it
possible to determine at run-time whether the called method is resumed?

Thanks in advance,

Mack Stevenson




More information about the Python-list mailing list