I have code snipped like :
class A:
def test(self):
return 'A'
class B(A):
def test(self):
return 'B->' + super(B, self).test()
print(B().test())
Output : B->A
If I write something like this then I'm getting the same output :
class A:
def test(self):
return 'A'
class B(A):
def test(self):
return 'B->' + super().test() # change to super()
print(B().test())
In both cases I'm getting the same output. Then, I want to know what's the difference between this two types of calling of super
? What are the pros and cons of using either of them?