I'm just now learning about python OOP. In some framework's source code, i came across return super(...
and wondered if there was a difference between the two.
class a(object):
def foo(self):
print 'a'
class b(object):
def foo(self):
print 'b'
class A(a):
def foo(self):
super(A, self).foo()
class B(b):
def foo(self):
return super(B, self).foo()
>>> aie = A(); bee = B()
>>> aie.foo(); bee.foo()
a
b
Looks the same to me. I know that OOP can get pretty complicated if you let it, but i don't have the wherewithal to come up with a more complex example at this point in my learning. Is there a situation where returning super
would differ from calling super
?
"x"
andreturn "x"
? – user2246674 Sep 6 '13 at 3:23