From fea1fdaf979ae835de8dad7016d952180c2896f4 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Thu, 5 Sep 2024 10:34:02 -0700 Subject: [PATCH] Python: Remove `Attributable.__len__` For consistency because its only a mixin class. Write migration guide for breaking change. --- NEWS.rst | 3 +++ src/binding/python/Attributable.cpp | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index 89089391a4..5f95465cff 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -15,6 +15,9 @@ Note that ADIOS2 does not support compression in BP3 files. pybind11 2.12.0 is now the minimally supported version for Python support. +The ``len(...)`` of many classes has been reworked for consistency and returns now the number of entries (iterations, record components, etc.). +Previously, this sporadically returned the number of attributes, which is better queried via ``len(.attributes)``. + 0.15.0 ------ diff --git a/src/binding/python/Attributable.cpp b/src/binding/python/Attributable.cpp index 2383ceab50..806a57b666 100644 --- a/src/binding/python/Attributable.cpp +++ b/src/binding/python/Attributable.cpp @@ -629,8 +629,6 @@ void init_Attributable(py::module &m) .def("delete_attribute", &Attributable::deleteAttribute) .def("contains_attribute", &Attributable::containsAttribute) - .def("__len__", &Attributable::numAttributes) - // @todo _ipython_key_completions_ if we find a way to add a [] // interface