2

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.

chekhovana
  • 81
  • 1
  • 4
  • 1
    FYI: your question was closed not because it is not goot (IMHO, it indeed deserves the upvotes) but because the answers are already provided in another question. – Serge Ballesta Dec 03 '20 at 09:57

0 Answers0