Semantics of propagated exceptions

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Jul 21 06:39:57 EDT 2006


In message <pan.2006.07.21.09.57.12.847175 at ID-174572.user.uni-berlin.de>,
Thomas Lotze wrote:

> Suppose you have a function f which, as part of its protocol, raises some
> standard exception E under certain, well-defined circumstances. Suppose
> further that f calls other functions which may also raise E. How to best
> distinguish whether an exception E raised by f has the meaning defined by
> the protocol or just comes from details of the implementation?

You can't. All the information necessary to identify the exception must be
in the exception object itself. If you want to distinguish between
exceptions raised by F and those raised by other functions called by F,
then they must be different exceptions.



More information about the Python-list mailing list