Jun-08-2020, 10:57 PM
So what is the accepted practice for properties? I've read (and been warned by lint) that it is bad form to define instance variables outside __init__. But so many property examples show the property setter used to create the _variable. If this is ok:
def __init__(self): self.variable = 5 @property def variable(self): return self._variable @variable.setter def variable(self, value): self._variable = valuewhy is this bad:
def __init(self)__: self.reset() def reset(self): self.scale = 1 self.offset = 0