subclassing Exceptions

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Jul 23 20:48:42 EDT 2001


phawkins at spamnotconnact.com wrote:
> 
> >>> raise strExceptionWithArg, "no thanks"

Shouldn't that be

   raise strExceptionWithArg("no thanks")

?

According to my reading of the docs, the first form
is illegal, since if the exception is a class and a 
value is supplied it is supposed to be a subclass of the
exception class.

The real mystery is why it seems to work in some
cases anyway...

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list