Questions on class inheritance super().__init__

I have seen some examples where super().init() is written and other times where super().init(arg1,art2).
what is the difference?

I have one more question. When parent and child class init are perfectly same, is there no need to write def init in child class?
Do we need to write above codes only when we want to add new attributes to child class init?

def __init__(self, arg1, arg2, arg3):
  super().__init__(self, arg1,arg2)
  self.arg3 = arg3

The arguments (attributes) we pass to super() are the ones we don’t want to override, meaning they are not defined in the derived class __init__() (along with your arg3).

When the child class has no instance attributes of its own, then it will have no attributes written in its __init__() method, but it will still need to super().__init__() any arguments it takes in, otherwise it won’t have those attributes defined.

1 Like