Template Function lsst::utils::python::addOutputOp

Function Documentation

template<class PyClass>
void lsst::utils::python::addOutputOp(PyClass &cls, std::string const &method)

Add __str__ or __repr__ method implemented by operator<<.

For flexibility, this method can be used to define one or both of __str__ and __repr__. It can also be used to define any Python method that takes no arguments and returns a string, regardless of name.

Template Parameters
  • PyClass: The pybind11 class_ type. The wrapped class must support << as a stream output operator.

Parameters
  • cls: The PyClass object to which to add a wrapper.

  • method: The name of the method to implement. Should be "__str__" or "__repr__".