<li><strong>Options can be generated dynamically: <codeclass="python hljs"><spanclass="hljs-string">f'<spanclass="hljs-subst">{<el>:{<str/int>}</span>[…]}'</span></code>.</strong></li>
<li><strong>Options can be generated dynamically: <codeclass="python hljs"><spanclass="hljs-string">f'<spanclass="hljs-subst">{<el>:{<str/int>}</span>[…]}'</span></code>.</strong></li>
<li><strong>Adding <codeclass="python hljs"><spanclass="hljs-string">'!r'</span></code> before the colon converts object to string by calling its <ahref="#class">repr()</a> method.</strong></li>
<li><strong>Adding <codeclass="python hljs"><spanclass="hljs-string">'='</span></code> to the expression prepends it to the output: <codeclass="python hljs"><spanclass="hljs-string">f'<spanclass="hljs-subst">{<spanclass="hljs-number">1</span>+<spanclass="hljs-number">1</span>=}</span>'</span></code> returns <codeclass="python hljs"><spanclass="hljs-string">'1+1=2'</span></code>.</strong></li>
<li><strong>Adding <codeclass="python hljs"><spanclass="hljs-string">'!r'</span></code> to the expression converts object to string by calling its <ahref="#class">repr()</a> method.</strong></li>
<li><strong>Passed values can be of type str, int, float, bytes, None, bool, datetime.date or datetime.datetime.</strong></li>
<li><strong>Passed values can be of type str, int, float, bytes, None, bool, datetime.date or datetime.datetime.</strong></li>
<li><strong>Bools will be stored and returned as ints and dates as <ahref="#encode">ISO formatted strings</a>.</strong></li>
<li><strong>Bools will be stored and returned as ints and dates as <ahref="#encode">ISO formatted strings</a>.</strong></li>
</ul>
</ul>
<div><h3id="example">Example</h3><p><strong>Values are not actually saved in this example because <codeclass="python hljs"><spanclass="hljs-string">'conn.commit()'</span></code> is omitted!</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>conn = sqlite3.connect(<spanclass="hljs-string">'test.db'</span>)
<div><h3id="example-1">Example</h3><p><strong>Values are not actually saved in this example because <codeclass="python hljs"><spanclass="hljs-string">'conn.commit()'</span></code> is omitted!</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>conn = sqlite3.connect(<spanclass="hljs-string">'test.db'</span>)
<spanclass="hljs-meta">>>></span>conn.execute(<spanclass="hljs-string">'CREATE TABLE person (person_id INTEGER PRIMARY KEY, name, height)'</span>)
<spanclass="hljs-meta">>>></span>conn.execute(<spanclass="hljs-string">'CREATE TABLE person (person_id INTEGER PRIMARY KEY, name, height)'</span>)
<spanclass="hljs-meta">>>></span>conn.execute(<spanclass="hljs-string">'INSERT INTO person VALUES (NULL, ?, ?)'</span>, (<spanclass="hljs-string">'Jean-Luc'</span>, <spanclass="hljs-number">187</span>)).lastrowid
<spanclass="hljs-meta">>>></span>conn.execute(<spanclass="hljs-string">'INSERT INTO person VALUES (NULL, ?, ?)'</span>, (<spanclass="hljs-string">'Jean-Luc'</span>, <spanclass="hljs-number">187</span>)).lastrowid
<dict> = vars(<object>) <spanclass="hljs-comment"># Dict of writable attributes. Also <obj>.__dict__.</span>
<dict> = vars(<object>) <spanclass="hljs-comment"># Dict of writable attributes. Also <obj>.__dict__.</span>
<bool> = hasattr(<object>, <spanclass="hljs-string">'<attr_name>'</span>) <spanclass="hljs-comment"># Checks if getattr() raises an AttributeError.</span>
<bool> = hasattr(<object>, <spanclass="hljs-string">'<attr_name>'</span>) <spanclass="hljs-comment"># Checks if getattr() raises an AttributeError.</span>
value = getattr(<object>, <spanclass="hljs-string">'<attr_name>'</span>) <spanclass="hljs-comment"># Raises AttributeError if attribute is missing.</span>
value = getattr(<object>, <spanclass="hljs-string">'<attr_name>'</span>) <spanclass="hljs-comment"># Raises AttributeError if attribute is missing.</span>
@ -2226,7 +2225,7 @@ right = [[<span class="hljs-number">0.1</span>, <span class="hljs-number">0.6</
<div><h3id="example-1">Example</h3><div><h4id="foreachpointreturnsindexofitsnearestpoint010608121">For each point returns index of its nearest point (<codeclass="python hljs">[<spanclass="hljs-number">0.1</span>, <spanclass="hljs-number">0.6</span>, <spanclass="hljs-number">0.8</span>] => [<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>, <spanclass="hljs-number">1</span>]</code>):</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>points = np.array([<spanclass="hljs-number">0.1</span>, <spanclass="hljs-number">0.6</span>, <spanclass="hljs-number">0.8</span>])
<div><h3id="example-2">Example</h3><div><h4id="foreachpointreturnsindexofitsnearestpoint010608121">For each point returns index of its nearest point (<codeclass="python hljs">[<spanclass="hljs-number">0.1</span>, <spanclass="hljs-number">0.6</span>, <spanclass="hljs-number">0.8</span>] => [<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>, <spanclass="hljs-number">1</span>]</code>):</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>points = np.array([<spanclass="hljs-number">0.1</span>, <spanclass="hljs-number">0.6</span>, <spanclass="hljs-number">0.8</span>])
'<strong>For details about sorted(), min() and max() see <a href="#sortable">sortable</a>.</strong>':'<strong>For details about sorted(), min() and max() see sortable (p. 16).</strong>',
'<strong>For details about sorted(), min() and max() see <a href="#sortable">sortable</a>.</strong>':'<strong>For details about sorted(), min() and max() see sortable (p. 16).</strong>',
'<strong>Module <a href="#operator">operator</a> provides functions itemgetter() and mul() that offer the same functionality as <a href="#lambda">lambda</a> expressions above.</strong>':'<strong>Module \'operator\' (p. 31) provides functions itemgetter() and mul() that offer the same functionality as lambda expressions (p. 11) above.</strong>',
'<strong>Module <a href="#operator">operator</a> provides functions itemgetter() and mul() that offer the same functionality as <a href="#lambda">lambda</a> expressions above.</strong>':'<strong>Module \'operator\' (p. 31) provides functions itemgetter() and mul() that offer the same functionality as lambda expressions (p. 11) above.</strong>',
'<strong>Adding <code class="python hljs"><span class="hljs-string">\'!r\'</span></code> before the colon converts object to string by calling its <a href="#class">repr()</a> method.</strong>':'<strong>Adding <code class="python hljs"><span class="hljs-string">\'!r\'</span></code> before the colon converts object to string by calling its repr() method (p. 14).</strong>',
'<strong>Adding <code class="python hljs"><span class="hljs-string">\'!r\'</span></code> to the expression converts object to string by calling its <a href="#class">repr()</a> method.</strong>':'<strong>Adding <code class="python hljs"><span class="hljs-string">\'!r\'</span></code> to the expression converts object to string by calling its repr() method (p. 14).</strong>',
'<strong>It can be any <a href="#callable">callable</a>, but is usually implemented as a function that returns a <a href="#closure">closure</a>.</strong>':'<strong>It can be any callable, but is usually implemented as a function that returns a closure.</strong>',
'<strong>It can be any <a href="#callable">callable</a>, but is usually implemented as a function that returns a <a href="#closure">closure</a>.</strong>':'<strong>It can be any callable, but is usually implemented as a function that returns a closure.</strong>',
'<strong>Objects can be made <a href="#sortable">sortable</a> 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>':'<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>',
'<strong>Objects can be made <a href="#sortable">sortable</a> 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>':'<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>',
'<strong>For object to be <a href="#hashable">hashable</a>, all attributes must be hashable and \'frozen\' must be True.</strong>':'<strong>For object to be hashable, all attributes must be hashable and \'frozen\' must be True.</strong>',
'<strong>For object to be <a href="#hashable">hashable</a>, all attributes must be hashable and \'frozen\' must be True.</strong>':'<strong>For object to be hashable, all attributes must be hashable and \'frozen\' must be True.</strong>',