Change status of PEP 352 to final.

Also clarified wording to reflect the implementation; only exceptions are
new-style class.  Wording was ambiguous and suggested that you could raise
any new-style class which was considered insane by everyone at the core sprint
at PyCon 2006.  And, most importantly, a Tim-channeled Guido thought that the
current implementation was the way to go.  No one should be able to ``raise
42``.
This commit is contained in:
Brett Cannon 2006-03-01 04:48:52 +00:00
parent 7e0013445c
commit 81eabf7a0d
2 changed files with 8 additions and 16 deletions

View File

@ -67,7 +67,6 @@ Index by Category
SA 328 Imports: Multi-Line and Absolute/Relative Aahz
SA 343 The "with" Statement GvR, Coghlan
SA 352 Required Superclass for Exceptions GvR, Cannon
Open PEPs (under consideration)
@ -166,6 +165,7 @@ Index by Category
SF 327 Decimal Data Type Batista
SF 341 Unifying try-except and try-finally Brandl
SF 342 Coroutines via Enhanced Generators GvR, Eby
SF 352 Required Superclass for Exceptions GvR, Cannon
SF 353 Using ssize_t as the index type von Loewis
Empty PEPs (or containing only an abstract)

View File

@ -3,7 +3,7 @@ Title: Required Superclass for Exceptions
Version: $Revision$
Last-Modified: $Date$
Author: Brett Cannon <brett@python.org>, Guido van Rossum <guido@python.org>
Status: Accepted
Status: Final
Type: Standards Track
Content-Type: text/x-rst
Created: 27-Oct-2005
@ -16,10 +16,11 @@ Abstract
In Python 2.4 and before, any (classic) class can be raised as an
exception. The plan is to allow new-style classes starting in Python
2.5, but this makes the problem worse -- it would mean *any* class (or
instance) can be raised! This is a problem since it prevents any
guarantees to be made about the interface of exceptions. This PEP
proposes introducing a new superclass that all raised objects must
inherit from. Imposing the restriction will allow a standard
instance) can be raised (this is not the case in the final version;
only built-in exceptions can be new-style)! This is a problem since it
prevents any guarantees to be made about the interface of exceptions.
This PEP proposes introducing a new superclass that all raised objects
must inherit from. Imposing the restriction will allow a standard
interface for exceptions to exist that can be relied upon.
One might counter that requiring a specific base class for a
@ -86,8 +87,6 @@ will cause the deprecation of the existing ``args`` attribute)::
def __repr__(self):
if not self.args:
argss = "()"
elif len(self.args) <= 1:
argss = "(%s)" % repr(self.message)
else:
argss = repr(self.args)
return self.__class__.__name__ + argss
@ -208,8 +207,6 @@ desired.
* Python 2.5
- allow exceptions to be new-style classes
- all standard exceptions become new-style classes
- introduce BaseException
@ -248,12 +245,7 @@ desired.
Implementation
==============
An initial patch to make exceptions new-style classes has been
authored by Michael Hudson can be found at SF patch #1104669
[#SF_1104669]_. While it does not implement all points mentioned in
this PEP, it will most likely be used as a basis for the final path
to implement this PEP.
The initial implementation of this PEP has been checked into Python 2.5 .
References
==========