I'm currently stunned by some Python behavior:
class Base(object):
def foo(self):
self.__virtual_function()
self.virtual_function()
def __virtual_function(self):
print("private Base")
def virtual_function(self):
print("public Base")
class Derived(Base):
def __virtual_function(self):
print("private Derived")
def virtual_function(self):
print("public Derived")
d = Derived()
d.foo()
This prints
private Base
public Derived
Is the double underscore effectively making a method private, and thus not overridable by subclasses?