#include #include #include struct base { virtual ~base() {} virtual int perform() = 0; }; struct base_wrap: base, boost::python::wrapper { int perform() { return int(this->get_override("perform")()) - 10; } }; BOOST_PYTHON_MODULE(example) { namespace python = boost::python; python::class_("Base", python::init<>()) .def("perform", python::pure_virtual(&base::perform)) ; python::class_>("BaseList") .def(python::vector_indexing_suite>()) ; python::def("do_perform", +[](base* object) { return object->perform(); }); } >>> import example >>> class derived(example.Base): ... def __init__(self): ... self.name = "test" ... example.Base.__init__(self) ... def perform(self): ... return 42 ... >>> d = derived() >>> base_list = example.BaseList() >>> base_list.append(d) >>> assert(len(base_list) == 1) >>> assert(base_list[0].perform() == 42) >>> assert(example.do_perform(base_list[0]) == 32)