Skip to content

Commit 4ecd54f

Browse files
committed
Class
1 parent 8f52062 commit 4ecd54f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,8 @@ class <class_name>:
10351035
<attr_name_2>: <type> = <default_value>
10361036
<attr_name_3>: list/dict/set = field(default_factory=list/dict/set)
10371037
```
1038-
* **Objects can be made sortable with `'order=True'` and/or immutable and hashable with `'frozen=True'`.**
1038+
* **Objects can be made sortable with `'order=True'` and immutable with `'frozen=True'`.**
1039+
* **For object to be hashable, all attributes must be hashable and frozen must be True.**
10391040
* **Function field() is needed because `'<attr_name>: list = []'` would make a list that is shared among all instances.**
10401041
* **Default_factory can be any [callable](#callable).**
10411042

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,8 @@
10081008

10091009

10101010
<ul>
1011-
<li><strong>Objects can be made sortable with <code class="python hljs"><span class="hljs-string">'order=True'</span></code> and/or immutable and hashable with <code class="python hljs"><span class="hljs-string">'frozen=True'</span></code>.</strong></li>
1011+
<li><strong>Objects can be made sortable with <code class="python hljs"><span class="hljs-string">'order=True'</span></code> and immutable with <code class="python hljs"><span class="hljs-string">'frozen=True'</span></code>.</strong></li>
1012+
<li><strong>For object to be hashable, all attributes must be hashable and frozen must be True.</strong></li>
10121013
<li><strong>Function field() is needed because <code class="python hljs"><span class="hljs-string">'&lt;attr_name&gt;: list = []'</span></code> would make a list that is shared among all instances.</strong></li>
10131014
<li><strong>Default_factory can be any <a href="#callable">callable</a>.</strong></li>
10141015
</ul>

0 commit comments

Comments
 (0)