>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Hi - I wrote a custom exception class as follows:

class CustomError(Exception):
    def __init__(self, msg):
        super(CustomError, self).__init__(self, msg)

But this doesn't work as expected:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Correct use of super would be:

class CustomError(Exception):
    def __init__(self, msg):
        super(CustomError, self).__init__(msg)

(Don't add self as an argument.)

Exception became a new-style class in Python 2.5.

-- Paul

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to