Interfaces and Exceptions

  • Thread starter Calvin Spealman
  • Start date
C

Calvin Spealman

Two somewhat related questions:

1) Is there a standard Interface class or module? Is it included with the
python distribution or is it third party?

2) How can I raise an exception and catch it based on the interfaces it
implements?
 
H

Hung Jung Lu

Calvin Spealman said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top