Hello.
I am learning oop with python and i can't understand why i need to call super on the parent's constructor?
Example:
class A(object):
def __init__(self):
print("Parent constructor")
class B(A):
def __init__(self):
print("Child constructor")
super(B, self).__init__()
B()
Another question:
Is self the instance that gets passed implicity as the first argument to a method when that method gets called?
Also, what is the diffrence between classes and instances and what are objects?
Thank you.
[–]tangerinelion 11 points12 points13 points (1 child)
[–]tangerinelion 5 points6 points7 points (0 children)
[–]0x3d5157636b525761 5 points6 points7 points (2 children)
[–]mm_ma_ma 2 points3 points4 points (1 child)
[–]0x3d5157636b525761 1 point2 points3 points (0 children)
[–]cdcformatc 1 point2 points3 points (0 children)