How do I override a parent class's functions in python?
I have a private method def __pickSide(self): in a parent class that I would like to override in the child class. However, the child class still calls the inherited def __pickSide(self): . How can I override the function? The child class's function name is exactly the same as the parent's function name. Let's look at the easiest example: from dis import dis class A(object): def __pick(self): print "1" def doitinA(self): self.__pick() class B(A): def __pick(self): print "2" def doitinB(self): self.__pick() b = B() b.doitinA() # prints 1 b.doitinB() # prints 2 dis(A.doitinA) print dis(B.doitinB)