Re: Property for dataclass field with default value

2020-06-18 Thread Ivan Ivanyuk
On Thu, 18 Jun 2020 at 11:26, Peter Otten <__pete...@web.de> wrote: > > Ivan Ivanyuk wrote: > > > Hello All, > > > > I have some trouble using @dataclass together with @property decorator > > or property() function. > > > > From the documentat

Property for dataclass field with default value

2020-06-17 Thread Ivan Ivanyuk
nt): if z > 1: self._x = z else: raise ValueError c= Container(x=10) print(c) c= Container() print(c) output is: Container(x=10) Container(x=30) So, what I'm missing here? Is there some way to use field() or decorators to make property just work th