Skip to content
Advertisement

Tag: private-members

Override a “private” method in Python

Consider a class with a “private” method such as: When I try to subclass Foo and override method __method, it can be seen that Foo.__method is still called, instead of MoreFoo.__method. What would be the way to override such a method? Answer The point of using the double-underscore name convention is to prevent subclasses from (accidentally) overriding the method. If

Advertisement