-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
We would like to have simple attribute access on these curves, with the option of validation (all need to be proper numpy arrays, with the same length and so on)
this looks much like a case for a property:
- http://tomayko.com/writings/getters-setters-fuxors
- http://www.blog.pythonlibrary.org/2014/01/20/python-201-properties/
In essence, we make these attributes semi-private, by prefixing an underscore
With this, we can have both: easy attribute access, without breaking compatibliy to old code, like in the tests:
aif = model.aif
model.aif = newaif
and can perform validation (which is not done yet):
def get_aif(self):
return self._aif
def set_aif(self, newaif):
# t.b.d. check input validity
self._aif = newaif
all by means of a simple
aif = property(set_aif, get_aif)
or something along this line