message of Exception

Steven Woody narkewoody at gmail.com
Wed Jan 7 00:03:51 EST 2009


On Wed, Jan 7, 2009 at 12:02 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> 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 ;-).

Ok, I will adapt the advice.



More information about the Python-list mailing list