Preferred exception style?

Steven Taschuk staschuk at telusplanet.net
Fri May 30 16:00:00 EDT 2003


Quoth George Young:
  [...]
> Furthermore, the parenthesis form allows for more than just
> a string value.  E.g.:
> class GetRunFailed(Exception):
> 	def __init__(self, reqobj, dberrormsg=None,
>                      domainerr='Run does not exist'):
  [...]

Positional parameters (but not keyword arguments) can be passed
with the comma syntax, using a tuple in the second place:

    raise GetRunFailed, (reqobj, dberrormsg, domainerr)

The familiar special case for 1-tuples occurs here too, of course.

-- 
Steven Taschuk    staschuk at telusplanet.net
"Tomorrow never happens."  -- Janis Joplin





More information about the Python-list mailing list