Arguments of user-defined exception

Viewed 17

I can't understand how the arguments of CustomException are initialized in the following case:

class CustomException(Exception):
    def __init__(self, msg):
        print('init:', self.args)

ce = CustomException('error message')
print(ce.args)

The output is:

init: ('error message',)
('error message',)

It seems that during instantiation of CustomException the superclass constructor is called implicitly, but it should not.

0 Answers
Related