message of Exception

Terry Reedy tjreedy at udel.edu
Tue Jan 6 23:02:20 EST 2009


Steven Woody wrote:
> Hi,
> 
> I am trying define an Exception as below:
> 
> class MyError(Exception):
>     def __init__(self, message):
>         self.message = message
> 
> And, I expect that when I raise a MyError as
>     raise MyError, "my message"

In 2.x you may and in 3.0 you must write that as
raise MyError("my message")
Best to start looking forward ;-).




More information about the Python-list mailing list