[Python-Dev] PEP 352: Required Superclass for Exceptions

Brett Cannon bcannon at gmail.com
Sat Oct 29 05:27:27 CEST 2005


On 10/28/05, Guido van Rossum <guido at python.org> wrote:
> [Trying to cut this short... We have too many threads for this topic. :-( ]
>
> On 10/28/05, Nick Coghlan <ncoghlan at gmail.com> wrote:
> [on making args b/w compatible]
> > I agree changing the behaviour is highly unlikely to cause any serious
> > problems (mainly because anyone *caring* about the contents of args is rare),
> > the current behaviour is relatively undocumented, and the PEP now proposes
> > deprecating ex.args immediately, so Guido's well within his rights if he wants
> > to change the behaviour.
>
> I take it back. Since the feature will disappear in Python 3.0 and is
> maintained only for b/w compatibility, we should keep it as b/w
> compatible as possible. That means it should default to () and always
> have as its value exactly the positional arguments that were passed.
>
> OTOH, I want message to default to "", not to None (even though it
> will be set to None if you explicitly pass None as the first
> argument). So the constructor could be like this (until Python 3000):
>
> def __init__(self, *args):
>     self.args = args
>     if args:
>         self.message = args[0]
>     else:
>         self.message = ""
>
> I think Nick proposed this before as well, so let's just do this.

Yeah, but Nick used the conditional operator and I used that.  All checked in.

-Brett


More information about the Python-Dev mailing list