diff --git a/python/sdist/amici/numpy.py b/python/sdist/amici/numpy.py index b84e52cc2b..3449a19642 100644 --- a/python/sdist/amici/numpy.py +++ b/python/sdist/amici/numpy.py @@ -91,6 +91,13 @@ def __init__(self, swigptr): self._cache = {} super(SwigPtrView, self).__init__() + # create properties for all fields + for field in self._field_names: + if not hasattr(self.__class__, field): + setattr( + self.__class__, field, property(lambda self: self[field]) + ) + def __len__(self) -> int: """ Returns the number of available keys/fields