diff --git a/src/python/pybind11/stats.cc b/src/python/pybind11/stats.cc index e6912e2ff6..1e6773f04a 100644 --- a/src/python/pybind11/stats.cc +++ b/src/python/pybind11/stats.cc @@ -149,9 +149,15 @@ pybind_init_stats(py::module_ &m_native) py::class_>( m, "ScalarInfo") - .def("value", &Stats::ScalarInfo::value) - .def("result", &Stats::ScalarInfo::result) - .def("total", &Stats::ScalarInfo::total) + .def_property_readonly("value", [](const Stats::ScalarInfo &info) { + return info.value(); + }) + .def_property_readonly("result", [](const Stats::ScalarInfo &info) { + return info.result(); + }) + .def_property_readonly("total", [](const Stats::ScalarInfo &info) { + return info.total(); + }) ; py::class_