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:
parent
f0e8e2b2e1
commit
d48c263a9d
74
pep-0348.txt
74
pep-0348.txt
|
@ -7,7 +7,7 @@ Status: Draft
|
||||||
Type: Standards Track
|
Type: Standards Track
|
||||||
Content-Type: text/x-rst
|
Content-Type: text/x-rst
|
||||||
Created: 28-Jul-2005
|
Created: 28-Jul-2005
|
||||||
Post-History: 03-Aug-2005
|
Post-History:
|
||||||
|
|
||||||
|
|
||||||
Abstract
|
Abstract
|
||||||
|
@ -104,7 +104,7 @@ New Hierarchy
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
+-- BaseException (new; broader inheritance for subclasses)
|
+-- BaseException (new; broader inheritance for subclasses)
|
||||||
+-- TerminalException (new; stricter inheritance for subclasses)
|
+-- TerminatingException (new; stricter inheritance for subclasses)
|
||||||
+-- KeyboardInterrupt
|
+-- KeyboardInterrupt
|
||||||
+-- SystemExit
|
+-- SystemExit
|
||||||
+-- Exception
|
+-- Exception
|
||||||
|
@ -118,12 +118,13 @@ New Hierarchy
|
||||||
+-- AttributeError
|
+-- AttributeError
|
||||||
+-- EnvironmentError
|
+-- EnvironmentError
|
||||||
+-- IOError
|
+-- IOError
|
||||||
+-- EOFError (broader inheritance)
|
+-- EOFError
|
||||||
+-- OSError
|
+-- OSError
|
||||||
+-- ImportError
|
+-- ImportError
|
||||||
+-- LookupError
|
+-- LookupError
|
||||||
+-- IndexError
|
+-- IndexError
|
||||||
+-- KeyError
|
+-- KeyError
|
||||||
|
+-- MemoryError
|
||||||
+-- NameError
|
+-- NameError
|
||||||
+-- UnboundLocalError
|
+-- UnboundLocalError
|
||||||
+-- NotImplementedError (stricter inheritance)
|
+-- NotImplementedError (stricter inheritance)
|
||||||
|
@ -137,15 +138,12 @@ New Hierarchy
|
||||||
+-- UnicodeEncodeError
|
+-- UnicodeEncodeError
|
||||||
+-- UnicodeTranslateError
|
+-- UnicodeTranslateError
|
||||||
+-- ValueError
|
+-- ValueError
|
||||||
+-- VMError (new; broader inheritance for subclasses)
|
|
||||||
+-- MemoryError
|
|
||||||
+-- SystemError
|
|
||||||
+-- ReferenceError
|
+-- ReferenceError
|
||||||
+-- StopIteration
|
+-- StopIteration
|
||||||
|
+-- SystemError
|
||||||
+-- Warning
|
+-- Warning
|
||||||
+-- AnyDeprecationWarning (new; broader inheritance for subclasses)
|
+-- PendingDeprecationWarning
|
||||||
+-- PendingDeprecationWarning
|
+-- DeprecationWarning
|
||||||
+-- DeprecationWarning
|
|
||||||
+-- FutureWarning
|
+-- FutureWarning
|
||||||
+-- SyntaxWarning
|
+-- SyntaxWarning
|
||||||
+-- RuntimeWarning
|
+-- RuntimeWarning
|
||||||
|
@ -171,30 +169,17 @@ BaseException
|
||||||
The superclass that all exceptions must inherit from.
|
The superclass that all exceptions must inherit from.
|
||||||
|
|
||||||
|
|
||||||
TerminalException
|
TerminatingException
|
||||||
'''''''''''''''''
|
''''''''''''''''''''
|
||||||
|
|
||||||
Superclass for exceptions that are meant to the termination of the
|
Superclass for exceptions that are meant to the termination of the
|
||||||
interpreter. It does not inherit from Exception so that
|
interpreter. It does not inherit from Exception so that
|
||||||
subclasses are not caught by bare ``except`` clauses.
|
subclasses are not caught by bare ``except`` clauses.
|
||||||
|
|
||||||
|
Naming based on the idea that the interpreter is trying to terminate when these
|
||||||
VMError
|
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.
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
Removed Exceptions
|
Removed Exceptions
|
||||||
|
@ -221,15 +206,6 @@ as a quick-and-dirty exception. Thus it now directly inherits from
|
||||||
Exception.
|
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``
|
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
|
causing existing Python programmers extra pain, the renamings were
|
||||||
removed.
|
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
|
Acknowledgements
|
||||||
================
|
================
|
||||||
|
|
Loading…
Reference in New Issue