Super().__init__ constructor

Why is it that when, in a child class, you call the parent’s constructor with super(), you do not need to include ‘self’ as one of the arguments?

Code and link below: ( the last line is my problem)
Thanks

https://www.codecademy.com/courses/learn-python-3/lessons/inheritance-and-polymorphism/exercises/super

class PotatoSalad:
def init(self, potatoes, celery, onions):
self.potatoes = potatoes
self.celery = celery
self.onions = onions

class SpecialPotatoSalad(PotatoSalad):
def init(self, potatoes, celery, onions):
super().init(potatoes, celery, onions)

1 Like

The instance of the derived class is also an instance of the parent class, so self is in context.

1 Like

super() carries self with it. It says, “Take self up to the parent class, perform the indicated method there, then return here.”

1 Like