exception message output problem
Fredrik Lundh
fredrik at pythonware.com
Sat Dec 22 08:34:12 EST 2007
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.
</F>
More information about the Python-list
mailing list