Error raising style

Gerrit Holl gerrit.holl at pobox.com
Sun Feb 6 13:16:29 EST 2000


Hello,

I want to start a discussion on error raising style. I see the following
almost always:
>>> raise Exception, 'aaa'

But I find this better:
>>> raise Exception('aaa')

because when raising an error with multiple errors, the former isn't
possible:
>>> raise Exception, 'aaa', 'bbb'
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: raise 3rd arg must be traceback or None

Guido's style guide doesn't talk about it, probably because the
call-raising is only possible since class exceptions. Is all those
code because of backward compatibility and people who are used to
this style of raising exceptions?

What do you think?

regards,
Gerrit.




More information about the Python-list mailing list