[Python-Dev] Pre-PEP: Exception Reorganization for Python 3.0
Nick Coghlan
ncoghlan at gmail.com
Sun Jul 31 09:05:24 CEST 2005
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.
Regards,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.blogspot.com
More information about the Python-Dev
mailing list