
Author: brett.cannon Date: Sat Oct 29 05:22:31 2005 New Revision: 41348 Modified: peps/trunk/pep-0352.txt Log: Update the code for BaseException to have 'args' be more backwards-compatible. Also reformat some methods to use the conditional operator to make the code simpler. Also moved the deprecation of 'args' and '__getitem__' to Python 2.9 so that it won't be removed during the 2.x series. Modified: peps/trunk/pep-0352.txt ============================================================================== --- peps/trunk/pep-0352.txt (original) +++ peps/trunk/pep-0352.txt Sat Oct 29 05:22:31 2005 @@ -66,27 +66,26 @@ def __init__(self, message='', *args): """Set 'message' and 'args' attribute""" self.message = message - self.args = (message,) + args + self.args = ((message,) + args + if message != '' + else tuple()) def __str__(self): """Return the str of 'message'""" - if len(self.args) > 1: - return str(self.args) - else: - return str(self.message) + return str(self.message + if not self.args + else self.args) def __unicode__(self): """Return the unicode of 'message'""" - if len(self.args) > 1: - return unicode(self.args) - else: - return unicode(self.message) + return unicode(self.message + if not self.args + else self.args) def __repr__(self): - if len(self.args) > 1: - args_repr = "*%s" % self.args - else: - args_repr = repr(self.message) + args_repr = (repr(self.message) + if not self.args + else "*%r" % self.args) return "%s(%s)" % (self.__class__.__name__, args_repr) def __getitem__(self, index): @@ -190,7 +189,8 @@ Python 3.0 while providing a smooth transition for 2.x code. All deprecations mentioned in the plan will lead to the removal of the semantics starting in the version following the introduction of the -deprecation. +deprecation and the raising of a DeprecationWarning for the version +specifically listed. * Python 2.5 @@ -216,6 +216,9 @@ - deprecate catching exceptions that do not inherit from BaseException + +* Python 2.9 + - deprecate ``args`` and ``__getitem__``
participants (1)
-
brett.cannon@python.org