Scale back proposal even more: VMError and AnyDeprecationWarning have been

removed along with EOFError no longer inheriting from IOError.
TerminalException was renamed TerminatingException.

At this point the only changes to the exception hierarchy are the addition of
BaseException and TerminatingException, and the change of inheritance for
KeyboardInterrupt, SystemExit, and NotImplementedError.
This commit is contained in:
Brett Cannon 2005-08-09 04:26:28 +00:00
parent f0e8e2b2e1
commit d48c263a9d
1 changed files with 37 additions and 37 deletions

View File

@ -7,7 +7,7 @@ Status: Draft
Type: Standards Track
Content-Type: text/x-rst
Created: 28-Jul-2005
Post-History: 03-Aug-2005
Post-History:
Abstract
@ -104,7 +104,7 @@ New Hierarchy
.. parsed-literal::
+-- BaseException (new; broader inheritance for subclasses)
+-- TerminalException (new; stricter inheritance for subclasses)
+-- TerminatingException (new; stricter inheritance for subclasses)
+-- KeyboardInterrupt
+-- SystemExit
+-- Exception
@ -118,12 +118,13 @@ New Hierarchy
+-- AttributeError
+-- EnvironmentError
+-- IOError
+-- EOFError (broader inheritance)
+-- EOFError
+-- OSError
+-- ImportError
+-- LookupError
+-- IndexError
+-- KeyError
+-- MemoryError
+-- NameError
+-- UnboundLocalError
+-- NotImplementedError (stricter inheritance)
@ -137,15 +138,12 @@ New Hierarchy
+-- UnicodeEncodeError
+-- UnicodeTranslateError
+-- ValueError
+-- VMError (new; broader inheritance for subclasses)
+-- MemoryError
+-- SystemError
+-- ReferenceError
+-- StopIteration
+-- SystemError
+-- Warning
+-- AnyDeprecationWarning (new; broader inheritance for subclasses)
+-- PendingDeprecationWarning
+-- DeprecationWarning
+-- PendingDeprecationWarning
+-- DeprecationWarning
+-- FutureWarning
+-- SyntaxWarning
+-- RuntimeWarning
@ -171,30 +169,17 @@ BaseException
The superclass that all exceptions must inherit from.
TerminalException
'''''''''''''''''
TerminatingException
''''''''''''''''''''
Superclass for exceptions that are meant to the termination of the
interpreter. It does not inherit from Exception so that
subclasses are not caught by bare ``except`` clauses.
VMError
'''''''
Superclass for exceptions that deal directly with the virtual
machine.
AnyDeprecationWarning
'''''''''''''''''''''
A common superclass for all deprecation-related exceptions. While
having DeprecationWarning inherit from PendingDeprecationWarning was
suggested (a DeprecationWarning can be viewed as a
PendingDeprecationWarning that is happening now), the logic was not
agreed upon by a majority. But since the exceptions are related,
creating a common superclass is warranted.
Naming based on the idea that the interpreter is trying to terminate when these
exceptions are raised. An earlier proposal suggested "TerminalException" but
avoidance of any confusion with an actual terminal along with "terminal" being
more fatalistic than "terminating" led to the current name choice.
Removed Exceptions
@ -221,15 +206,6 @@ as a quick-and-dirty exception. Thus it now directly inherits from
Exception.
EOFError
''''''''
Subclasses IOError.
Since an EOF comes from I/O it only makes sense that it be considered
an I/O error.
Required Superclass for ``raise``
=================================
@ -446,6 +422,30 @@ about them ever. To minimize backwards-compatibility issues and
causing existing Python programmers extra pain, the renamings were
removed.
Have EOFError Subclass IOError
------------------------------
The original thought was that sine EOFError deals directly with I/O, it should
subclass IOError. But since EOFError is used more as a signal that an event
has occurred (the exhaustion of an I/O port), it should not subclass such a
specific error exception.
Have MemoryError and SystemError Have a Common Superclass
---------------------------------------------------------
Both classes deal with the interpreter, so why not have them have a common
superclass? Because one of them means that the interpreter is in a state that
it should not recover from while the other does not.
Common Superclass for PendingDeprecationWarning and DeprecationWarning
----------------------------------------------------------------------
Grouping the deprecation warning exceptions together makes intuitive sense.
But this sensical idea does not extend well when one considers how rarely
either warning is used, let along at the same time.
Acknowledgements
================