How to invoke all parents classes constructors in python ?
I am searching for better way to invoke all constructors of parents classes the below code works but I think there is better way to invoke all parents classes constructors. And please explain the super.init parts of the code. class A: def __init__(self, name): self.name = name class B: def __init__(self, city): self.city = city class C: def __init__(self, color): self.color = color class D(A, B, C): def __init__(self, name, city, color, age): super().__init__(name) super(A, self).__init__(city) super(B, self).__init__(color) self.age = age obj = D('samip', 'sam', 22, 'brown') print(obj.name) print(obj.city) print(obj.age) print(obj.color)