-
Notifications
You must be signed in to change notification settings - Fork 2
Description
The BtoV class contains properties like BtoV.mL are public and can be set/modified after initializing the class, e.g. BtoV.mL = ..., but should not. The reason is that mL is used to set the attributes BtoV.kinematics and subsequently BtoV.w_max, BtoV.w_min etc, and those will not get updated if you set the mL property.
I suggest using leading underscore to mark those properites that should just be set via the constructor and are otherwise internal as private by making their names have leading underscores. We could also add a property function called mL that allows to obtain the stored lepton mass, but doesn't allow for it being set. Then, optionally, we could also add a setter function of the same name, e.g. something like:
@property
def mL(self):
return self._mL
@mL.setter
def mL(self, value):
if value < 0:
raise ValueError(...)
# update value
self._mL = value
# update kinematics
self.kinematics = ...
self.w_max = ...I agree that we want to make this idiot prove.
If mL should be private, or a property with setter (so that it also sets it correctly in all other > classes of the composite class) is a thing to debate.
Originally posted by @MarkusPrim in #2 (comment)