I\'ve got these classes.
Person
is the parent class and Student
is the child class:
class Person(object):
def __init__(self, name):
You can use
super(Student, self).__init__(name)
in which self has been passed to init method,so you don't need to write it out again in __init__
method.
But if you use
super(Student, Student).__init__(self, name)
or
super(Student, self.__class__).__init__(self, name)
you have to write down self in __init__
method.
If you are using super, you don't pass self
to the target method. It is passed implicitly.
super(Student, self).__init__(name)
That's 2 arguments total (self, name). When you passed self
, that was 3 total (self, self, name).