diff --git a/pep-0000.txt b/pep-0000.txt index fc77c0d4c..648c67a9f 100644 --- a/pep-0000.txt +++ b/pep-0000.txt @@ -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) diff --git a/pep-0352.txt b/pep-0352.txt index ccb60a660..7774eeb7c 100644 --- a/pep-0352.txt +++ b/pep-0352.txt @@ -3,7 +3,7 @@ Title: Required Superclass for Exceptions Version: $Revision$ Last-Modified: $Date$ Author: Brett Cannon , Guido van Rossum -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 ==========