For example,
class ImmutableParameter(dataobject, readonly=True):
b: float = 1.0
def example_method(self):
return 20
class ImmutableSubclass(ImmutableParameter):
a: float = 2.0
I would expect (or like to have a way) for 'a' to be an immutable field without setting readonly=True as an option in the subclass. Instead, the following is possible:
ims = ImmutableSubclass()
ims.a = 3.0
I will note that the behavior for inherited fields is correct, returning the expected AttributeError
For example,
I would expect (or like to have a way) for 'a' to be an immutable field without setting
readonly=Trueas an option in the subclass. Instead, the following is possible:I will note that the behavior for inherited fields is correct, returning the expected
AttributeError