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

Mel mwilson at the-wire.com
Sun Mar 9 07:21:54 EDT 2008


Lie wrote:
[ ... ]
> Soft Exception
> What is "Soft Exception"?
> Soft Exception is an exception that if is unhandled, pass silently as
> if nothing happened. For example, if a variable turns into NoneType,
> it'll raise Soft Exception that it have become NoneException,
> programmers that wants to handle it can handle it with a try...except
> block while programmers that doesn't care about it (or know it won't
> be a problem to his code) can just leave the code as it is.
> 
> Soft Exception differs from Hard Exceptions (the regular Exception) in
> a way that Hard Exception must be handled at all cost or the program
> will be terminated while Soft Exception allow programmers not to
> handle it if they don't want to.
[ ... ]
> Ideology Base:
> - EAAP: Easier to apologize than to ask permission.

Sort of like a COME FROM statement.  Drastic effects on program 
execution: a `raise SoftException` in the middle of a loop would break 
the loop if a catcher existed, or leave the loop running if not.  It 
would really need the ability to resume after catching an exception. 
You can't really talk about 'apologize' around something that's so 
irreparable.

I'd try for this effect by creating a class of objects with 
well-defined callbacks.

	Mel.



More information about the Python-list mailing list