* **Objects can be made sortable with `'order=True'` and immutable with `'frozen=True'`.**
* **For object to be hashable, all attributes must be hashable and frozen must be True.**
* **Function field() is needed because `'<attr_name>: list = []'` would make a list that is shared among all instances. Argument 'default_factory' can be any [callable](#callable).**
* **Function field() is needed because `'<attr_name>: list = []'` would make a list that is shared among all instances. Its 'default_factory' argument can be any [callable](#callable).**
* **For attributes of arbitrary type use `'typing.Any'`.**
#### Inline:
@ -1906,7 +1906,7 @@ with <conn>: # Exits the block with commit()
@ -1040,7 +1040,7 @@ Z = dataclasses.make_dataclass(<span class="hljs-string">'Z'</span>, [<span clas
<ul>
<li><strong>Objects can be made sortable with <codeclass="python hljs"><spanclass="hljs-string">'order=True'</span></code> and immutable with <codeclass="python hljs"><spanclass="hljs-string">'frozen=True'</span></code>.</strong></li>
<li><strong>For object to be hashable, all attributes must be hashable and frozen must be True.</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. Argument 'default_factory' can be any <ahref="#callable">callable</a>.</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. Its 'default_factory' argument can be any <ahref="#callable">callable</a>.</strong></li>
<li><strong>For attributes of arbitrary type use <codeclass="python hljs"><spanclass="hljs-string">'typing.Any'</span></code>.</strong></li>
<div><h3id="mysql">MySQL</h3><p><strong>Has a very similar interface, with differences listed below.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-comment"># $ pip3 install mysql-connector</span>
<spanclass="hljs-keyword">from</span> mysql <spanclass="hljs-keyword">import</span> connector
<cursor> = <conn>.cursor() <spanclass="hljs-comment"># Only cursor has execute method.</span>
<cursor> = <conn>.cursor() <spanclass="hljs-comment"># Only cursor has execute() method.</span>
<cursor>.execute(<spanclass="hljs-string">'<query>'</span>) <spanclass="hljs-comment"># Can raise a subclass of connector.Error.</span>
<cursor>.execute(<spanclass="hljs-string">'<query>'</span>, <list/tuple>) <spanclass="hljs-comment"># Replaces '%s's in query with values.</span>
<cursor>.execute(<spanclass="hljs-string">'<query>'</span>, <dict/namedtuple>) <spanclass="hljs-comment"># Replaces '%(<key>)s's with values.</span>
@ -2543,7 +2543,7 @@ rect = pg.Rect(<span class="hljs-number">240</span>, <span class="hljs-number">2
<div><h3id="rectangle">Rectangle</h3><p><strong>Object for storing rectangular coordinates.</strong></p><pre><codeclass="python language-python hljs"><Rect> = pg.Rect(x, y, width, height) <spanclass="hljs-comment"># Floats get truncated into ints.</span>