I'm using pybind11 to wrap a C++ class method in a conversion lambda "shim" (I must do this because reasons). One of the method's arguments is defaulted in C++.
class A
{
void meow(Eigen::Matrix4f optMat = Eigen::Matrix4f::Identity());
};
In my pybind code I want to preserve this optional parameter:
py::class_<A>(m, "A")
.def(py::init<>())
.def("meow",
[](A& self, Eigen::Matrix4f optMat = Eigen::Matrix4f::Identity())
{
return self.meow( optMat );
});
How do I make optMat
an optional named argument in the generated Python code?