Preferred exception style?
Steven Taschuk
staschuk at telusplanet.net
Sat May 31 00:17:27 EDT 2003
Quoth Bengt Richter:
[...]
> ISTM it could be useful to use keyword parameters and just do self.__dict__.update(kw)
> so they'd show up as exception instance attributes, like errno, etc., e.g.,
[...]
> ... raise X2(1,2,3, one=1,two=2)
[...]
> >>> vars(e)
> {'args': (1, 2, 3), 'two': 2, 'one': 1}
I'd prefer to see e.args and e.kwargs, to avoid name collisions.
(What if one of the keyword arguments is called "args", for
example?)
This is unrelated to the question of the syntax for raising
exceptions, of course.
--
Steven Taschuk staschuk at telusplanet.net
"I tried to be pleasant and accommodating, but my head
began to hurt from his banality." -- _Seven_ (1996)
More information about the Python-list
mailing list