[Python-Dev] Re: Exceptional inheritance patterns

Guido van Rossum guido at python.org
Fri Aug 6 16:52:39 CEST 2004


>     Michael> I would like an exception class that almost exceptions except
>     Michael> KeyboardInterrupt, SystemExit and -- maybe -- RuntimeError and
>     Michael> MemoryError inherited from.
> 
>     Michael> except ExceptionsButThoseNastyOnesIDontWantToCatch:
>     Michael>     pass
> 
>     Michael> ? <wink>
> 
> I proposed a change to the exceptions hierarchy a few years ago that would
> allow this.  It was obviously never implemented, but I no longer remember
> why.
> 
> Skip

Probably inertia and compatibility issues (2.2 must've been brand new
when you proposed that).  I've become swayed by Paul Prescod's recent
argument that exceptions use subclassing for classification reasons
and that there's nothing wrong with *requiring* them to subclass some
common base class.

--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list