[Python-Dev] Pre-PEP: Exception Reorganization for Python 3.0
Brett Cannon
bcannon at gmail.com
Sun Jul 31 18:17:10 CEST 2005
On 7/31/05, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Brett Cannon wrote:
> >>Notice that I've classified KeyboardInterrupt as user-initiated control flow
> >>and put it under ControlFlowException above. This means that everything under
> >>CriticalError and Error actually ends with the word 'Error'.
> >
> > I don't know if I like this change in inheritance. While we do tend
> > to use KeyboardInterrupt as a way to kill a program, is that really
> > control flow, or a critical exception that the program needs to stop
> > because an serious event occurred?
> >
> > I prefer the latter explanation.
>
> You're probably right. How does the following reasoning sound:
>
> SystemExit, GeneratorExit and StopIteration are all deliberately triggered by
> certain well-defined elements of normal application code. That is, only
> certain operations will ever result in a ControlFlowException being raised.
>
> KeyboardInterrupt is a better fit with MemoryError and SystemError - something
> that occurs unexpectedly, at an arbitary point during program execution. That
> is, a CriticalError may be raised when attempting to execute almost any operation.
>
Yeah, those explanations work for me. I think I am going to have to
write an explanation for every exception so its usage is clear.
-Brett
More information about the Python-Dev
mailing list