I have a dataclass with an attribute 'open' of type float.I added a property setter which shall throw a ValueError in case it gets set to a negative value:
@open.setterdef open(self, value: float) -> None: if value < 0.0: raise ValueError("Open value must be positive.") self.open = value
The error I am getting is:
File "<string>", line 4, in __init__ File "/home/PATH/file.py", line 29, in open if value < 0.0: ^^^^^^^^^^^ TypeError: '<' not supported between instances of 'property' and 'float'
I don't really get what I am doing wrong here.Thanks for any advice!