I would like to call the __init__
method of the superclass. Here are two way I can think of:
super().__init__(some_arg) # I am using Python 3
# or like this:
MyBaseClass.__init__(self, some_arg)
What is the preferred way of doing it?
I would like to call the __init__
method of the superclass. Here are two way I can think of:
super().__init__(some_arg) # I am using Python 3
# or like this:
MyBaseClass.__init__(self, some_arg)
What is the preferred way of doing it?
super().__init__(*args, **kwargs)
Perceive you don't pass the "self" - it is inserted automatically.
Super() was first designed in Python 2 to allow classes to be reused as mixins in a class hierarchy in a way that their immediate superclass may change,