class B(A):

    def bar(self):
        print('two')

def test(objs, funcname):
    noop = lambda : None
for o in objs:
    getattr(o, funcname, noop)()
objs = [A(), B()]
test(objs, 'bar')
Passing a "pointer to a virtual function" as argument in Python