Open
Description
I have a workaround to create classmethods in PyBind.
template<class Func, typename ... Args>
pybind11::object classmethod(Func f, Args ... args) {
pybind11::object cf = pybind11::cpp_function(f, args...);
return pybind11::object(PyClassMethod_New(cf.ptr()), true);
}
used like this
void foo(py::object cls, ...);
cls.attr("foo") = classmethod(&foo);
Be useful to have such mechanism in pybind proper