What c.l.py's opinions about Soft Exception?

metawilm at gmail.com metawilm at gmail.com
Mon Mar 10 20:14:40 CET 2008

On Mar 9, 2:21 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> Is this soft-exception implemented anywhere, so that one can see what
> experiences and best practices have evolved around using it?

Lie's idea is to separate exceptions in two groups, those that must be
handled and those that don't. A better way is to have two different
ways to raise exceptions: one exceptional situation can be "Hard" in
some situations and "Soft" in others, and it is up to the way of
raising to make the choice, while the exception stays the same.

Common Lisp has two ways of raising: functions "error" and "signal".
Python's "raise" is like CL's "error": you end up in the debugger if
the exception is not handled. Exceptions that are raised by CL's
"signal" don't have to be caught: if there is no matching "except"
clause the raise statement becomes a "pass".

Or as Wikipedia states nicely: "Conditions are a generalization of
exceptions. When a condition arises, an appropriate condition handler
is searched for and selected, in stack order, to handle the condition.
Conditions which do not represent errors may safely go unhandled
entirely; their only purpose may be to propagate hints or warnings
toward the user."


- Willem

More information about the Python-list mailing list