Why self is not used with super() method? It's not mentioned in the topic

Noticed this only after started doing quiz, don’t fully understand why self is not used with super()… Maybe it needs to be mentioned explicitly in the course :slight_smile:

Hi @Dmitry_Polovinkin
We can use super with parameters. super() can take two parameters: the first is the subclass, and the second parameter is an object that is an instance of that subclass.

I see, thank you! So you are talking about parameters of the super() itself? Like super(subclass, subclass_object)? :slight_smile: Great to know?
But I believe didn’t make the question specific enough - why don’t we use the self in the super()._ _ init _ _()? :slight_smile:

for example:

class Rectangle:
    def __init__(self, length, width):
    self.length = length
    self.width = width

    def area(self):
    return self.length * self.width

    def perimeter(self):
    return 2 * self.length + 2 * self.width

class Square(Rectangle):
    def __init__(self, length):
        super(Square, self).__init__(length, length)

In Python 3, the super(Square, self) call is equivalent to the parameterless super() call. The first parameter refers to the subclass Square, while the second parameter refers to a Square object which, in this case, is self. You can call super() with other classes as well.