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

Brett Cannon bcannon at gmail.com
Sun Jul 31 04:20:20 CEST 2005


On 7/30/05, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Brett Cannon wrote:
[SNIP]
> >>     +-- RuntimeError
> > I still don't like the name.
> 
> I'm not that fond of it either - but as the builtin exception most likely to
> be used (abused?) by user code, I expect changing its name would be more pain
> than it's worth.
>

Maybe, but I am still going to nudge for a change.  It might get shot
down in the end, but at least I can say I tried.
 
> >>         +-- NotImplementedError
> > Interesting idea, but I don't view them as the same.  Everyone uses
> > RuntimeError as a Poor Man's Exception, not as an actual runtime
> > error.
> 
> This particular inheritance is copied from Python 2.4 :)
> 

Ah, oops.  =)

Well, I still don't think they should inherit like that and instead be
decoupled.

> I find the main trick with making RuntimeError more palatable is to avoid
> thinking of 'runtime' in the sense of 'Python runtime', as in 'Python VM'.
> That's not what this error is about - a Python VM error is a SystemError.
> Instead, a RuntimeError is a generic application error - something which
> happened during happened at program runtime.
> 

Right, you shouldn't think that, but isn't that what you thought
initially?  That is why I want to rename RuntimeError.

> Renaming RuntimeWarning to SemanticsWarning should help with that distinction.
> 

Well, not once the name is changed since people won't know about the
former name connection.  =)

> >>+-- Warning
> >>     +-- DeprecationWarning
> >>     +-- FutureWarning
> >>     +-- PendingDeprecationWarning
> >
> >
> > Don't like the idea of having DeprecationWarning inherit from
> > PendingDeprecationWarning?
> 
> Not really. Mainly because I'm not sure which way the inheritance should go -
> I could understand someone wanting to suppress PendingDeprecationWarnings
> without suppressing DeprecationWarnings. On the other hand, there's your
> argument that a 'DeprecationWarning is just a PendingDeprecationWarning with a
> shorter timeframe'.
> 
> Again, I fell back on the concept that Python's except clause makes it easy to
> ask for both if you want both, but makes it relatively difficult to undo
> exception inheritance if it isn't what you want.
> 

True, but the hierarchy should still properly reflect increasing
severity in my opinion.  I am going to push for this; we will see if I
get pushed back enough to not do it.

-Brett


More information about the Python-Dev mailing list