I have a class with "create" methods for different types of arguments: #include <boost/python.hpp>
class Test { public: Test() {} Test(int x) : _type(x) {} static Test create(int) { return Test(0); } static Test create(double) { return Test(1); } static Test create(const char*) { return Test(2); } int get_type() const { return _type; } private: int _type; }; using namespace boost::python; BOOST_PYTHON_MODULE(Test) { class_<Test>("Test") .def("create", (Test (*)(int)) &Test::create) .def("create", (Test (*)(double)) &Test::create) .def("create", (Test (*)(const char*)) &Test::create) .def("get_type", &Test::get_type) .staticmethod("create") ; } The python wrappers created by boost don't seem to distinguish between create(int) and create(double), although they do notice create(const char*): >>> from Test import * >>> x = Test.create(0) >>> print x.get_type() 1 >>> x = Test.create(0.0) >>> print x.get_type() 1 >>> y = Test.create("hi") >>> print y.get_type() 2 Any ideas what I do wrong? _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig