Yes. Consider the case where, instead of typing, the superclass foo returned something:
class BaseAdder(object): def add(self, a, b): return a + b class NonReturningAdder(BaseAdder): def add(self, a, b): super(NonReturningAdder, self).add(a, b) class ReturningAdder(BaseAdder): def add(self, a, b): return super(ReturningAdder, self).add(a, b)
For two instances:
>>> a = NonReturningAdder() >>> b = ReturningAdder()
When we call foo on a , nothing seems to happen:
>>> a.add(3, 5)
When we call foo on b , we get the expected result:
>>> b.add(3, 5) 8
This is because when both NonReturningAdder and ReturningAdder call BaseAdder foo , NonReturningAdder discards the return value, while ReturningAdder passes it.
icktoofay
source share