Skip to content

Commit

Permalink
Wrap << using wrapOutputOp.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfindeisen committed Jan 31, 2018
1 parent 2fa83af commit 443d864
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions python/lsst/meas/modelfit/mixture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,8 @@ static PyMixtureComponent declareMixtureComponent(py::module &mod) {
"dim1"_a, "dim2"_a);
cls.def(py::init<int>(), "dim"_a);
cls.def(py::init<Scalar, Vector const &, Matrix const &>(), "weight"_a, "mu"_a, "sigma"_a);
auto streamStr = [](MixtureComponent const &self) {
std::ostringstream os;
os << self;
return os.str();
};
cls.def("__str__", streamStr);
cls.def("__repr__", streamStr);
utils::python::wrapOutputOp(cls, "__str__");
utils::python::wrapOutputOp(cls, "__repr__");
return cls;
}

Expand Down Expand Up @@ -133,14 +128,8 @@ static PyMixture declareMixture(py::module &mod) {
cls.def("clone", &Mixture::clone);
cls.def(py::init<int, Mixture::ComponentList &, Scalar>(), "dim"_a, "components"_a,
"df"_a = std::numeric_limits<Scalar>::infinity());
auto streamStr = [](Mixture const &self) {
std::ostringstream os;
os << self;
return os.str();
};
return cls;
cls.def("__str__", streamStr);
cls.def("__repr__", streamStr);
utils::python::wrapOutputOp(cls, "__str__");
utils::python::wrapOutputOp(cls, "__repr__");
return cls;
}

Expand Down

0 comments on commit 443d864

Please sign in to comment.