Interfaces and Exceptions

Hung Jung Lu hungjunglu at yahoo.com
Wed Jun 9 04:19:13 EDT 2004


Calvin Spealman <calvin at ironfroggy.com> wrote:
> 2) How can I raise an exception and catch it based on the interfaces it
> implements?

By using Java? :)

Seriously, checked exceptions a la Java were such a bad idea that even
Java people came up with "patterns" to convert them to unchecked
exceptions. C# designers simply discarded checked exceptions from a
start and designed their exception handling based on the Python
exception handling model. (This is mentioned in a Microsoft's paper,
but I don't have the reference off hand.)

So, no need to mix exceptions with interfaces, unless you are a
masochist.

http://www.mindview.net/Etc/Discussions/CheckedExceptions

regards,

Hung Jung



More information about the Python-list mailing list