471,337 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Multiple inheritence for exceptions?

Useful or a bad idea?

I have a module that defines a number of exceptions which inherit from
various built-ins like KeyError, ValueError etc. I'm considering defining
an abstract module exception like MyModuleError, and having all my real
exceptions inherit from it as well, but I don't recall seeing that done
before and I was wondering if it were a bad idea for some reason.
--
Steven.

Jun 3 '07 #1
1 1039
Steven D'Aprano <st***@REMOVE.THIS.cybersource.com.auwrote:
Useful or a bad idea?

I have a module that defines a number of exceptions which inherit from
various built-ins like KeyError, ValueError etc. I'm considering defining
an abstract module exception like MyModuleError, and having all my real
exceptions inherit from it as well, but I don't recall seeing that done
before and I was wondering if it were a bad idea for some reason.
I often do exactly what you propose, and I believe I have suggested it
in the Nutshell 2nd edition. I have never observed bad effects.
Alex
Jun 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Matthew Louden | last post: by
5 posts views Thread by Neelesh Bodas | last post: by
2 posts views Thread by Oblivion | last post: by
47 posts views Thread by Larry Smith | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.