From: Fernando P. <Fer...@co...> - 2004-11-18 18:57:30
|
John Hunter schrieb: > try : save_ps(fname) > except IOError, msg: > verbose.report_error('Backend PS failed to save %s'%fname) > raise IOError(msg) Just 'raise' is enough, python by default will re-raise the original exception untouched. I'll leave this discussion to you guys, I don't know the matplotlib code enough to contribute anything really useful. My only point is that reusing SystemExit for other purposes, with additional information encoded in the message, is IMHO a bad idea. There's a reason why exceptions make up a class hierarchy: this allows you to use classes for the flow control mechanisms, leaving the string messages simply as additional information mainly for the user. Since these messages are potentially locale-sensitive, and can change over time (spelling, capitalization, etc), it's just not a good idea to base code behaviour on them. Cheers, f |