**Decorator that automatically generates init(), repr() and eq() magic methods. Object can also be made sortable with `'order=True'` and/or immutable with `'frozen=True'`.**
**Decorator that automatically generates init(), repr() and eq() magic methods.**
<p><strong>Decorator that automatically generates init(), repr() and eq() magic methods. Object can also be made sortable with <codeclass="python hljs"><spanclass="hljs-string">'order=True'</span></code> and/or immutable with <codeclass="python hljs"><spanclass="hljs-string">'frozen=True'</span></code>.</strong></p>
<p><strong>Decorator that automatically generates init(), repr() and eq() magic methods.</strong></p>
<pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> dataclasses <spanclass="hljs-keyword">import</span> dataclass, field
<li><strong>An object can be made sortable with <codeclass="python hljs"><spanclass="hljs-string">'order=True'</span></code> or immutable with <codeclass="python hljs"><spanclass="hljs-string">'frozen=True'</span></code>.</strong></li>
<li><strong>Function field() is needed because <codeclass="python hljs"><spanclass="hljs-string">'<attr_name>: list = []'</span></code> would make a list that is shared among all instances.</strong></li>
<li><strong>Default_factory can be any callable.</strong></li>