[Python-Dev] Pre-PEP: Exception Reorganization for Python 3.0

Brett Cannon bcannon at gmail.com
Sat Jul 30 21:20:49 CEST 2005


On 7/30/05, James Y Knight <foom at fuhm.net> wrote:
> On Jul 29, 2005, at 11:07 PM, Robert Brewer wrote:
> 
> > I'd recommend not subclassing SystemExit--there are too many programs
> > out there which expect the argument (e.g. sys.exit(3)) to mean
> > something
> > specific, but that expectation doesn't apply at all to SystemError.
> 
> Yes please make note of this for *all* exception (and otherwise)
> inheritance. You must ensure that any exception B that inherits from
> A conforms to A's interface! If that isn't the case, it shouldn't
> inherit. Lots of people seem to forget this, and it's always a pain
> in the ass.
> 

The reason for requiring inheriting from Raisable is so that the basic
interface will be guaranteed for any caught exception.  And I don't
think that any of the built-ins have any specific attributes sans
maybe OSError, but that is a leaf in the inheritance tree so that is
not a problem.

Don't worry, the interfaces won't change in the middle of a branch.

-Brett


More information about the Python-Dev mailing list