* **Decimal numbers are stored exactly, unlike most floats where:`'1.1 + 2.2 != 3.3'`.**
* **Decimal numbers are stored exactly, unlike most floats where `'1.1 + 2.2 != 3.3'`.**
* **Floats can be compared with: `'math.isclose(<float>, <float>)'`.**
* **Precision of decimal operations is set with: `'decimal.getcontext().prec = <int>'`.**
* **Bools can be used anywhere ints can, because bool is a subclass of int: `'True + 1 == 2'`.**
@ -655,8 +655,8 @@ import zoneinfo, dateutil.tz
>>> dt.strftime("%dth of %B '%y (%a), %I:%M %p %Z")
"14th of August '25 (Thu), 11:39 PM UTC+02:00"
```
* **`'%z'` accepts `'±HH[:]MM'` and returns `'±HHMM'` or empty string if datetime is naive.**
* **`'%Z'` accepts `'UTC/GMT'` and local timezone's code and returns timezone's name, `'UTC[±HH:MM]'` if timezone is nameless, or an empty string if datetime is naive.**
* **`'%z'` accepts `'±HH[:]MM'` and returns `'±HHMM'` or empty string if object is naive.**
* **`'%Z'` accepts `'UTC/GMT'` and local timezone's code and returns timezone's name, `'UTC[±HH:MM]'` if timezone is nameless, or an empty string if object is naive.**
### Arithmetics
```python
@ -679,7 +679,7 @@ def <func_name>(<default_args>): ... # E.g. `def func(x=0, y
def <func_name>(<nondefault_args>, <default_args>): ... # E.g. `def func(x, y=0): ...`.
```
* **Function returns None if it doesn't encounter `'return <obj/exp>'` statement.**
* **Before modifying a global variable from within the function run `'global <var_name>'`.**
* **Run `'global <var_name>'` inside the function before assigning to global variable.**
* **Default values are evaluated when function is first encountered in the scope. Any mutation of a mutable default value will persist between invocations!**
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.IGNORECASE'</span></code> can be used with all functions.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.MULTILINE'</span></code> makes <codeclass="python hljs"><spanclass="hljs-string">'^'</span></code> and <codeclass="python hljs"><spanclass="hljs-string">'$'</span></code> match the start/end of each line.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.DOTALL'</span></code> makes <codeclass="python hljs"><spanclass="hljs-string">'.'</span></code> also accept the <codeclass="python hljs"><spanclass="hljs-string">'\n'</span></code>.</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'re.compile(<regex>)'</span></code> returns a Pattern object with methods sub(), findall(), …</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'re.compile(<regex>)'</span></code> returns a Pattern object with methods sub(), findall(), etc.</strong></li>
</ul>
<div><h3id="matchobject">Match Object</h3><pre><codeclass="python language-python hljs"><str> = <Match>.group() <spanclass="hljs-comment"># Returns the whole match. Also group(0).</span>
<str> = <Match>.group(<spanclass="hljs-number">1</span>) <spanclass="hljs-comment"># Returns part inside the first brackets.</span>
<li><strong>Decimal numbers are stored exactly, unlike most floats where:<codeclass="python hljs"><spanclass="hljs-string">'1.1 + 2.2 != 3.3'</span></code>.</strong></li>
<li><strong>Decimal numbers are stored exactly, unlike most floats where <codeclass="python hljs"><spanclass="hljs-string">'1.1 + 2.2 != 3.3'</span></code>.</strong></li>
<li><strong>Floats can be compared with: <codeclass="python hljs"><spanclass="hljs-string">'math.isclose(<float>, <float>)'</span></code>.</strong></li>
<li><strong>Precision of decimal operations is set with: <codeclass="python hljs"><spanclass="hljs-string">'decimal.getcontext().prec = <int>'</span></code>.</strong></li>
<li><strong>Bools can be used anywhere ints can, because bool is a subclass of int: <codeclass="python hljs"><spanclass="hljs-string">'True + 1 == 2'</span></code>.</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'%z'</span></code> accepts <codeclass="python hljs"><spanclass="hljs-string">'±HH[:]MM'</span></code> and returns <codeclass="python hljs"><spanclass="hljs-string">'±HHMM'</span></code> or empty string if datetime is naive.</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'%Z'</span></code> accepts <codeclass="python hljs"><spanclass="hljs-string">'UTC/GMT'</span></code> and local timezone's code and returns timezone's name, <codeclass="python hljs"><spanclass="hljs-string">'UTC[±HH:MM]'</span></code> if timezone is nameless, or an empty string if datetime is naive.</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'%z'</span></code> accepts <codeclass="python hljs"><spanclass="hljs-string">'±HH[:]MM'</span></code> and returns <codeclass="python hljs"><spanclass="hljs-string">'±HHMM'</span></code> or empty string if object is naive.</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'%Z'</span></code> accepts <codeclass="python hljs"><spanclass="hljs-string">'UTC/GMT'</span></code> and local timezone's code and returns timezone's name, <codeclass="python hljs"><spanclass="hljs-string">'UTC[±HH:MM]'</span></code> if timezone is nameless, or an empty string if object is naive.</strong></li>
</ul>
<div><h3id="arithmetics">Arithmetics</h3><pre><codeclass="python language-python apache hljs"><bool> = <D/T/DTn>><D/T/DTn><spanclass="hljs-comment"># Ignores time jumps (fold attribute). Also ==.</span>
<bool> = <DTa>><DTa><spanclass="hljs-comment"># Ignores time jumps if they share tzinfo object.</span>
<li><strong>Function returns None if it doesn't encounter <codeclass="python hljs"><spanclass="hljs-string">'return <obj/exp>'</span></code> statement.</strong></li>
<li><strong>Before modifying a global variable from within the function run <codeclass="python hljs"><spanclass="hljs-string">'global <var_name>'</span></code>.</strong></li>
<li><strong>Run <codeclass="python hljs"><spanclass="hljs-string">'global <var_name>'</span></code> inside the function before assigning to global variable.</strong></li>
<li><strong>Default values are evaluated when function is first encountered in the scope. Any mutation of a mutable default value will persist between invocations!</strong></li>
</ul>
<div><h3id="functioncall">Function Call</h3><pre><codeclass="python language-python hljs"><obj> = <function>(<positional_args>) <spanclass="hljs-comment"># E.g. `func(0, 0)`.</span>
@ -2944,7 +2944,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the active