Consider the following code:
class A:
def foo(self, a):
return a
def bar(self, a):
print(foo(a))
class B(A):
def foo(self, a):
return a[0]
Now calling B.bar(a)
the result is print(a[0])
, but what I want is print(a)
. More directly: I'd like that the calling of bar()
in a child class uses the definition of foo
given in A
even if overridden. How do i do that?