exception message output problem

Russ P. Russ.Paielli at gmail.com
Sat Dec 22 21:21:01 EST 2007


On Dec 22, 5:34 am, Fredrik Lundh <fred... at pythonware.com> wrote:
> Russ P. wrote:
> > Actually, the parens aren't needed, so this works too:
>
> >     def __init__(self, args=""): self.args = args,
>
> > The trailing comma wasn't necessary a while back (pre 2.5?), so
> > something in Python must have changed. I'd say that it looks a bit
> > cleaner without the trailing comma, so maybe whatever changed should
> > get changed back.
>
> as the name implies, "args" is supposed to be a sequence, and is stored
> internally as a tuple.  if something has changed, it's probably that 2.5
> enforces this behaviour via a property.
>
> to fix your code, just replace your own __init__ method with a "pass",
> and leave the initialization to the Exception class itself.

That works. And because it is the simplest solution here, I'd say it's
the "correct" solution. Thanks.




More information about the Python-list mailing list