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: try: raise CustomError('something bad') except CustomError, err: print err.message err.message is a blank string. I fixed this eventually by rewriting the call to the super constructor: class CustomError(Exception): def __init__(self, msg): Exception.__init__(self, msg) Now everything works, but I'm not sure I understand why super(...).__init__(...) behaves differently from Exception.__init__(...). According to the documentation, "super() only works with new-style classes". Is the problem that Exception is an "old style" class (I'm still learning what this means)? If so, how can I tell when I'm up against an "old style" class when using python? Why does super() fail silently, if this is the case? Thanks in advance for any pointers or help in understanding this!
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor