[Python-Dev] Exception Reorg PEP checked in
bcannon at gmail.com
Fri Aug 5 21:07:08 CEST 2005
On 8/4/05, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Brett Cannon wrote (in the PEP):
> > KeyboardInterrupt inheriting from ControlFlowException
> > KeyboardInterrupt has been a contentious point within this hierarchy. Some
> > view the exception as more control flow being caused by the user. But with
> > its asynchronous cause thanks to the user being able to trigger the
> > exception at any point in code it has a more proper place inheriting from
> > CriticalException. It also keeps the name of the exception from being
> > "CriticalError".
> I think this argues against your own hierarchy, since you _did_ call the
> parent exception CriticalError. By your argument above, that suggests
> KeyboardInterrupt doesn't belong there ;)
=) Drawback of having names swapped in and out so many times.
> In practice, whether KeyboardInterrupt inherits from ControlFlowException or
> CriticalError shouldn't be a big deal - the important thing is to get it out
> from under Exception and StandardError.
In general, probably.
> At which point, the naming issue is enough to incline me towards christening
> it a ControlFlowException. It gets all the 'oddly named' exceptions into one
Good point. I think I would like to see Guido's preference for this
since it feels like it should be under CriticalError.
> Additionally, consider that a hypothetical ThreadExit exception (used to
> terminate a thread semi-gracefully) would also clearly belong under
> ControlFlowException. That is, just because something is asynchronous with
> respect to the currently executing code doesn't necessarily make it an error
> (yes, I know I argued the opposite point the other day. . .).
Another good point. I am leaning towards moving it now, but I still
would like to hear Guido's preference, if he has one.
More information about the Python-Dev