The "function"super()
is useful in python for defining classes such as:
class Parent:
def __init__(self, trait):
self.trait = trait
class Child(Parent):
def __init__(self, primary_trait, secondary_trait):
super().__init__(primary_trait)
self.secondary_trait = secondary_trait
the syntax object.method()
and object.attribute
is usually used in python but if super()
really is a function, why does it use the same syntax? I've heard that in java it is a keyword, but I'm pretty sure that in python it is a function (because of the parentheses).