Browse Source

Renamed Arguments to Function, big changes in Splat and Inline

main
Jure Šorn 4 weeks ago
parent
commit
020bbb1970
6 changed files with 142 additions and 127 deletions
  1. 104
      README.md
  2. 103
      index.html
  3. 30
      parse.js
  4. 16
      pdf/index_for_pdf.html
  5. 12
      pdf/index_for_pdf_print.html
  6. 4
      web/script_2.js

104
README.md

@ -10,7 +10,7 @@ Contents
--------
**   ** **1. Collections:** ** ** **[`List`](#list)**__,__ **[`Dictionary`](#dictionary)**__,__ **[`Set`](#set)**__,__ **[`Tuple`](#tuple)**__,__ **[`Range`](#range)**__,__ **[`Enumerate`](#enumerate)**__,__ **[`Iterator`](#iterator)**__,__ **[`Generator`](#generator)**__.__
**   ** **2. Types:** **          ** **[`Type`](#type)**__,__ **[`String`](#string)**__,__ **[`Regular_Exp`](#regex)**__,__ **[`Format`](#format)**__,__ **[`Numbers`](#numbers-1)**__,__ **[`Combinatorics`](#combinatorics)**__,__ **[`Datetime`](#datetime)**__.__
**   ** **3. Syntax:** **         ** **[`Args`](#arguments)**__,__ **[`Inline`](#inline)**__,__ **[`Import`](#imports)**__,__ **[`Decorator`](#decorator)**__,__ **[`Class`](#class)**__,__ **[`Duck_Types`](#duck-types)**__,__ **[`Enum`](#enum)**__,__ **[`Exception`](#exceptions)**__.__
**   ** **3. Syntax:** **         ** **[`Function`](#function)**__,__ **[`Inline`](#inline)**__,__ **[`Import`](#imports)**__,__ **[`Decorator`](#decorator)**__,__ **[`Class`](#class)**__,__ **[`Duck_Type`](#duck-types)**__,__ **[`Enum`](#enum)**__,__ **[`Except`](#exceptions)**__.__
**   ** **4. System:** **        ** **[`Exit`](#exit)**__,__ **[`Print`](#print)**__,__ **[`Input`](#input)**__,__ **[`Command_Line_Arguments`](#command-line-arguments)**__,__ **[`Open`](#open)**__,__ **[`Path`](#paths)**__,__ **[`OS_Commands`](#os-commands)**__.__
**   ** **5. Data:** **             ** **[`JSON`](#json)**__,__ **[`Pickle`](#pickle)**__,__ **[`CSV`](#csv)**__,__ **[`SQLite`](#sqlite)**__,__ **[`Bytes`](#bytes)**__,__ **[`Struct`](#struct)**__,__ **[`Array`](#array)**__,__ **[`Memory_View`](#memory-view)**__,__ **[`Deque`](#deque)**__.__
**   ** **6. Advanced:** **   ** **[`Operator`](#operator)**__,__ **[`Match_Stmt`](#match-statement)**__,__ **[`Logging`](#logging)**__,__ **[`Introspection`](#introspection)**__,__ **[`Threading`](#threading)**__,__ **[`Coroutines`](#coroutines)**__.__
@ -671,86 +671,72 @@ import zoneinfo, dateutil.tz
```
Arguments
---------
### Inside Function Call
Function
--------
**Independent block of code that returns a value when called.**
```python
func(<positional_args>) # func(0, 0)
func(<keyword_args>) # func(x=0, y=0)
func(<positional_args>, <keyword_args>) # func(0, y=0)
def <func_name>(<nondefault_args>): ... # E.g. `def func(x, y): ...`.
def <func_name>(<default_args>): ... # E.g. `def func(x=0, y=0): ...`.
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>'`.**
* **Default values are evaluated when function is first encountered in the scope. Any mutation of a mutable default value will persist between invocations!**
### Function Call
### Inside Function Definition
```python
def func(<nondefault_args>): ... # def func(x, y): ...
def func(<default_args>): ... # def func(x=0, y=0): ...
def func(<nondefault_args>, <default_args>): ... # def func(x, y=0): ...
<obj> = <function>(<positional_args>) # E.g. `func(0, 0)`.
<obj> = <function>(<keyword_args>) # E.g. `func(x=0, y=0)`.
<obj> = <function>(<positional_args>, <keyword_args>) # E.g. `func(0, y=0)`.
```
* **Default values are evaluated when function is first encountered in the scope.**
* **Any mutation of a mutable default value will persist between invocations!**
Splat Operator
--------------
### Inside Function Call
**Splat expands a collection into positional arguments, while splatty-splat expands a dictionary into keyword arguments.**
```python
args = (1, 2)
kwargs = {'x': 3, 'y': 4, 'z': 5}
args, kwargs = (1, 2), {'z': 3}
func(*args, **kwargs)
```
#### Is the same as:
```python
func(1, 2, x=3, y=4, z=5)
func(1, 2, z=3)
```
### Inside Function Definition
**Splat combines zero or more positional arguments into a tuple, while splatty-splat combines zero or more keyword arguments into a dictionary.**
```python
def add(*a):
return sum(a)
```
```python
>>> def add(*a):
... return sum(a)
...
>>> add(1, 2, 3)
6
```
#### Legal argument combinations:
```python
def f(*args): ... # f(1, 2, 3)
def f(x, *args): ... # f(1, 2, 3)
def f(*args, z): ... # f(1, 2, z=3)
```
```python
def f(**kwargs): ... # f(x=1, y=2, z=3)
def f(x, **kwargs): ... # f(x=1, y=2, z=3) | f(1, y=2, z=3)
```
#### Allowed compositions of arguments inside function definition and the ways they can be called:
```python
def f(*args, **kwargs): ... # f(x=1, y=2, z=3) | f(1, y=2, z=3) | f(1, 2, z=3) | f(1, 2, 3)
def f(x, *args, **kwargs): ... # f(x=1, y=2, z=3) | f(1, y=2, z=3) | f(1, 2, z=3) | f(1, 2, 3)
def f(*args, y, **kwargs): ... # f(x=1, y=2, z=3) | f(1, y=2, z=3)
```
```python
def f(*, x, y, z): ... # f(x=1, y=2, z=3)
def f(x, *, y, z): ... # f(x=1, y=2, z=3) | f(1, y=2, z=3)
def f(x, y, *, z): ... # f(x=1, y=2, z=3) | f(1, y=2, z=3) | f(1, 2, z=3)
+--------------------+------------+--------------+----------------+------------------+
| | f(1, 2, 3) | f(1, 2, z=3) | f(1, y=2, z=3) | f(x=1, y=2, z=3) |
+--------------------+------------+--------------+----------------+------------------+
| f(x, *args, **kw): | yes | yes | yes | yes |
| f(*args, z, **kw): | | yes | yes | yes |
| f(x, **kw): | | | yes | yes |
| f(*, x, **kw): | | | | yes |
+--------------------+------------+--------------+----------------+------------------+
```
### Other Uses
```python
<list> = [*<coll.> [, ...]] # Or: list(<collection>) [+ ...]
<tuple> = (*<coll.>, [...]) # Or: tuple(<collection>) [+ ...]
<set> = {*<coll.> [, ...]} # Or: set(<collection>) [| ...]
<dict> = {**<dict> [, ...]} # Or: <dict> | ...
<list> = [*<collection> [, ...]] # Or: list(<collection>) [+ ...]
<tuple> = (*<collection>, [...]) # Or: tuple(<collection>) [+ ...]
<set> = {*<collection> [, ...]} # Or: set(<collection>) [| ...]
<dict> = {**<dict> [, ...]} # Or: <dict> | ...
```
```python
head, *body, tail = <coll.> # Head or tail can be omitted.
head, *body, tail = <collection> # Head or tail can be omitted.
```
@ -798,24 +784,32 @@ from functools import reduce
```
```python
>>> [a if a else 'zero' for a in (0, 1, 2, 3)] # `any([0, '', [], None]) == False`
>>> [i if i else 'zero' for i in (0, 1, 2, 3)] # `any([0, '', [], None]) == False`
['zero', 1, 2, 3]
```
### And, Or
```python
<obj> = <exp> and <exp> [and ...] # Returns first false or last operand.
<obj> = <exp> or <exp> [or ...] # Returns first true or last operand.
```
### Walrus Operator
```python
>>> [i for a in '0123' if (i := int(a)) > 0] # Assigns to variable mid-sentence.
[1, 2, 3]
```
### Named Tuple, Enum, Dataclass
```python
from collections import namedtuple
Point = namedtuple('Point', 'x y') # Creates a tuple's subclass.
Point = namedtuple('Point', 'x y') # Creates tuple's subclass.
point = Point(0, 0) # Returns its instance.
```
```python
from enum import Enum
Direction = Enum('Direction', 'N E S W') # Creates an enum.
Direction = Enum('Direction', 'N E S W') # Creates Enum's subclass.
direction = Direction.N # Returns its member.
```
```python
from dataclasses import make_dataclass
Player = make_dataclass('Player', ['loc', 'dir']) # Creates a class.
player = Player(point, direction) # Returns its instance.

103
index.html

@ -56,7 +56,7 @@
<body>
<header>
<aside>March 10, 2025</aside>
<aside>March 16, 2025</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -94,7 +94,7 @@ const browser_prefers_dark = window.matchMedia('(prefers-color-scheme: dark)').m
</script><pre style="border-left: none;padding-left: 1.9px;"><code class="hljs bash" style="line-height: 1.327em;"><strong>ToC</strong> = {
<strong><span class="hljs-string"><span class="hljs-string">'1. Collections'</span></span></strong>: [<a href="#list">List</a>, <a href="#dictionary">Dictionary</a>, <a href="#set">Set</a>, <a href="#tuple">Tuple</a>, <a href="#range">Range</a>, <a href="#enumerate">Enumerate</a>, <a href="#iterator">Iterator</a>, <a href="#generator">Generator</a>],
<strong><span class="hljs-string"><span class="hljs-string">'2. Types'</span></span></strong>: [<a href="#type">Type</a>, <a href="#string">String</a>, <a href="#regex">Regular_Exp</a>, <a href="#format">Format</a>, <a href="#numbers">Numbers</a>, <a href="#combinatorics">Combinatorics</a>, <a href="#datetime">Datetime</a>],
<strong><span class="hljs-string"><span class="hljs-string">'3. Syntax'</span></span></strong>: [<a href="#arguments">Args</a>, <a href="#inline">Inline</a>, <a href="#imports">Import</a>, <a href="#decorator">Decorator</a>, <a href="#class">Class</a>, <a href="#ducktypes">Duck_Types</a>, <a href="#enum">Enum</a>, <a href="#exceptions">Exception</a>],
<strong><span class="hljs-string"><span class="hljs-string">'3. Syntax'</span></span></strong>: [<a href="#function">Function</a>, <a href="#inline">Inline</a>, <a href="#imports">Import</a>, <a href="#decorator">Decorator</a>, <a href="#class">Class</a>, <a href="#ducktypes">Duck_Type</a>, <a href="#enum">Enum</a>, <a href="#exceptions">Except</a>],
<strong><span class="hljs-string"><span class="hljs-string">'4. System'</span></span></strong>: [<a href="#exit">Exit</a>, <a href="#print">Print</a>, <a href="#input">Input</a>, <a href="#commandlinearguments">Command_Line_Arguments</a>, <a href="#open">Open</a>, <a href="#paths">Path</a>, <a href="#oscommands">OS_Commands</a>],
<strong><span class="hljs-string"><span class="hljs-string">'5. Data'</span></span></strong>: [<a href="#json">JSON</a>, <a href="#pickle">Pickle</a>, <a href="#csv">CSV</a>, <a href="#sqlite">SQLite</a>, <a href="#bytes">Bytes</a>, <a href="#struct">Struct</a>, <a href="#array">Array</a>, <a href="#memoryview">Memory_View</a>, <a href="#deque">Deque</a>],
<strong><span class="hljs-string"><span class="hljs-string">'6. Advanced'</span></span></strong>: [<a href="#operator">Operator</a>, <a href="#matchstatement">Match_Stmt</a>, <a href="#logging">Logging</a>, <a href="#introspection">Introspection</a>, <a href="#threading">Threading</a>, <a href="#coroutines">Coroutines</a>],
@ -598,62 +598,55 @@ Point(x=<span class="hljs-number">1</span>, y=<span class="hljs-number">2</span>
&lt;float&gt; = &lt;TD&gt; / &lt;TD&gt; <span class="hljs-comment"># Also `(&lt;int&gt;, &lt;TD&gt;) = divmod(&lt;TD&gt;, &lt;TD&gt;)`.</span>
</code></pre></div>
<div><h2 id="arguments"><a href="#arguments" name="arguments">#</a>Arguments</h2><div><h3 id="insidefunctioncall">Inside Function Call</h3><pre><code class="python language-python hljs">func(&lt;positional_args&gt;) <span class="hljs-comment"># func(0, 0)</span>
func(&lt;keyword_args&gt;) <span class="hljs-comment"># func(x=0, y=0)</span>
func(&lt;positional_args&gt;, &lt;keyword_args&gt;) <span class="hljs-comment"># func(0, y=0)</span>
</code></pre></div></div>
<div><h3 id="insidefunctiondefinition">Inside Function Definition</h3><pre><code class="python language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">func</span><span class="hljs-params">(&lt;nondefault_args&gt;)</span>:</span> ... <span class="hljs-comment"># def func(x, y): ...</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">func</span><span class="hljs-params">(&lt;default_args&gt;)</span>:</span> ... <span class="hljs-comment"># def func(x=0, y=0): ...</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">func</span><span class="hljs-params">(&lt;nondefault_args&gt;, &lt;default_args&gt;)</span>:</span> ... <span class="hljs-comment"># def func(x, y=0): ...</span>
<div><h2 id="function"><a href="#function" name="function">#</a>Function</h2><p><strong>Independent block of code that returns a value when called.</strong></p><pre><code class="python language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> &lt;<span class="hljs-title">func_name</span>&gt;<span class="hljs-params">(&lt;nondefault_args&gt;)</span>:</span> ... <span class="hljs-comment"># E.g. `def func(x, y): ...`.</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> &lt;<span class="hljs-title">func_name</span>&gt;<span class="hljs-params">(&lt;default_args&gt;)</span>:</span> ... <span class="hljs-comment"># E.g. `def func(x=0, y=0): ...`.</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> &lt;<span class="hljs-title">func_name</span>&gt;<span class="hljs-params">(&lt;nondefault_args&gt;, &lt;default_args&gt;)</span>:</span> ... <span class="hljs-comment"># E.g. `def func(x, y=0): ...`.</span>
</code></pre></div>
<ul>
<li><strong>Default values are evaluated when function is first encountered in the scope.</strong></li>
<li><strong>Any mutation of a mutable default value will persist between invocations!</strong></li>
<li><strong>Function returns None if it doesn't encounter <code class="python hljs"><span class="hljs-string">'return &lt;obj/exp&gt;'</span></code> statement.</strong></li>
<li><strong>Before modifying a global variable from within the function run <code class="python hljs"><span class="hljs-string">'global &lt;var_name&gt;'</span></code>.</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><h2 id="splatoperator"><a href="#splatoperator" name="splatoperator">#</a>Splat Operator</h2><div><h3 id="insidefunctioncall-1">Inside Function Call</h3><p><strong>Splat expands a collection into positional arguments, while splatty-splat expands a dictionary into keyword arguments.</strong></p><pre><code class="python language-python hljs">args = (<span class="hljs-number">1</span>, <span class="hljs-number">2</span>)
kwargs = {<span class="hljs-string">'x'</span>: <span class="hljs-number">3</span>, <span class="hljs-string">'y'</span>: <span class="hljs-number">4</span>, <span class="hljs-string">'z'</span>: <span class="hljs-number">5</span>}
func(*args, **kwargs)
</code></pre></div></div>
<div><h3 id="functioncall">Function Call</h3><pre><code class="python language-python hljs">&lt;obj&gt; = &lt;function&gt;(&lt;positional_args&gt;) <span class="hljs-comment"># E.g. `func(0, 0)`.</span>
&lt;obj&gt; = &lt;function&gt;(&lt;keyword_args&gt;) <span class="hljs-comment"># E.g. `func(x=0, y=0)`.</span>
&lt;obj&gt; = &lt;function&gt;(&lt;positional_args&gt;, &lt;keyword_args&gt;) <span class="hljs-comment"># E.g. `func(0, y=0)`.</span>
</code></pre></div>
<div><h2 id="splatoperator"><a href="#splatoperator" name="splatoperator">#</a>Splat Operator</h2><p><strong>Splat expands a collection into positional arguments, while splatty-splat expands a dictionary into keyword arguments.</strong></p><pre><code class="python language-python hljs">args, kwargs = (<span class="hljs-number">1</span>, <span class="hljs-number">2</span>), {<span class="hljs-string">'z'</span>: <span class="hljs-number">3</span>}
func(*args, **kwargs)
</code></pre></div>
<div><h4 id="isthesameas">Is the same as:</h4><pre><code class="python language-python hljs">func(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, x=<span class="hljs-number">3</span>, y=<span class="hljs-number">4</span>, z=<span class="hljs-number">5</span>)
<div><h4 id="isthesameas">Is the same as:</h4><pre><code class="python language-python hljs">func(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, z=<span class="hljs-number">3</span>)
</code></pre></div>
<div><h3 id="insidefunctiondefinition-1">Inside Function Definition</h3><p><strong>Splat combines zero or more positional arguments into a tuple, while splatty-splat combines zero or more keyword arguments into a dictionary.</strong></p><pre><code class="python language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">add</span><span class="hljs-params">(*a)</span>:</span>
<span class="hljs-keyword">return</span> sum(a)
<div><h3 id="insidefunctiondefinition">Inside Function Definition</h3><p><strong>Splat combines zero or more positional arguments into a tuple, while splatty-splat combines zero or more keyword arguments into a dictionary.</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">add</span><span class="hljs-params">(*a)</span>:</span>
<span class="hljs-meta">... </span> <span class="hljs-keyword">return</span> sum(a)
<span class="hljs-meta">... </span>
<span class="hljs-meta">&gt;&gt;&gt; </span>add(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>)
<span class="hljs-number">6</span>
</code></pre></div>
<pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>add(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>)
<span class="hljs-number">6</span>
</code></pre>
<div><h4 id="legalargumentcombinations">Legal argument combinations:</h4><pre><code class="python language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(*args)</span>:</span> ... <span class="hljs-comment"># f(1, 2, 3)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(x, *args)</span>:</span> ... <span class="hljs-comment"># f(1, 2, 3)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(*args, z)</span>:</span> ... <span class="hljs-comment"># f(1, 2, z=3)</span>
<div><h4 id="allowedcompositionsofargumentsinsidefunctiondefinitionandthewaystheycanbecalled">Allowed compositions of arguments inside function definition and the ways they can be called:</h4><pre><code class="python language-python hljs">┏━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┓
┃ │ f(<span class="hljs-number"><span class="hljs-number">1</span></span>, <span class="hljs-number"><span class="hljs-number">2</span></span>, <span class="hljs-number"><span class="hljs-number">3</span></span>) │ f(<span class="hljs-number"><span class="hljs-number">1</span></span>, <span class="hljs-number"><span class="hljs-number">2</span></span>, z=<span class="hljs-number"><span class="hljs-number">3</span></span>) │ f(<span class="hljs-number"><span class="hljs-number">1</span></span>, y=<span class="hljs-number"><span class="hljs-number">2</span></span>, z=<span class="hljs-number"><span class="hljs-number">3</span></span>) │ f(x=<span class="hljs-number"><span class="hljs-number">1</span></span>, y=<span class="hljs-number"><span class="hljs-number">2</span></span>, z=<span class="hljs-number"><span class="hljs-number">3</span></span>) ┃
┠────────────────────┼────────────┼──────────────┼────────────────┼──────────────────┨
<span class="hljs-title">f</span>(x, *args, **kw): │ ✓ │ ✓ │ ✓ │ ✓ ┃
<span class="hljs-title">f</span>(*args, z, **kw): │ │ ✓ │ ✓ │ ✓ ┃
<span class="hljs-title">f</span>(x, **kw): │ │ │ ✓ │ ✓ ┃
<span class="hljs-title">f</span>(*, x, **kw): │ │ │ │ ✓ ┃
┗━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┛
</code></pre></div>
<pre><code class="python language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(**kwargs)</span>:</span> ... <span class="hljs-comment"># f(x=1, y=2, z=3)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(x, **kwargs)</span>:</span> ... <span class="hljs-comment"># f(x=1, y=2, z=3) | f(1, y=2, z=3)</span>
</code></pre>
<pre><code class="python language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(*args, **kwargs)</span>:</span> ... <span class="hljs-comment"># f(x=1, y=2, z=3) | f(1, y=2, z=3) | f(1, 2, z=3) | f(1, 2, 3)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(x, *args, **kwargs)</span>:</span> ... <span class="hljs-comment"># f(x=1, y=2, z=3) | f(1, y=2, z=3) | f(1, 2, z=3) | f(1, 2, 3)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(*args, y, **kwargs)</span>:</span> ... <span class="hljs-comment"># f(x=1, y=2, z=3) | f(1, y=2, z=3)</span>
</code></pre>
<pre><code class="python language-python hljs"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(*, x, y, z)</span>:</span> ... <span class="hljs-comment"># f(x=1, y=2, z=3)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(x, *, y, z)</span>:</span> ... <span class="hljs-comment"># f(x=1, y=2, z=3) | f(1, y=2, z=3)</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(x, y, *, z)</span>:</span> ... <span class="hljs-comment"># f(x=1, y=2, z=3) | f(1, y=2, z=3) | f(1, 2, z=3)</span>
</code></pre>
<div><h3 id="otheruses">Other Uses</h3><pre><code class="python language-python hljs">&lt;list&gt; = [*&lt;coll.&gt; [, ...]] <span class="hljs-comment"># Or: list(&lt;collection&gt;) [+ ...]</span>
&lt;tuple&gt; = (*&lt;coll.&gt;, [...]) <span class="hljs-comment"># Or: tuple(&lt;collection&gt;) [+ ...]</span>
&lt;set&gt; = {*&lt;coll.&gt; [, ...]} <span class="hljs-comment"># Or: set(&lt;collection&gt;) [| ...]</span>
&lt;dict&gt; = {**&lt;dict&gt; [, ...]} <span class="hljs-comment"># Or: &lt;dict&gt; | ...</span>
<div><h3 id="otheruses">Other Uses</h3><pre><code class="python language-python hljs">&lt;list&gt; = [*&lt;collection&gt; [, ...]] <span class="hljs-comment"># Or: list(&lt;collection&gt;) [+ ...]</span>
&lt;tuple&gt; = (*&lt;collection&gt;, [...]) <span class="hljs-comment"># Or: tuple(&lt;collection&gt;) [+ ...]</span>
&lt;set&gt; = {*&lt;collection&gt; [, ...]} <span class="hljs-comment"># Or: set(&lt;collection&gt;) [| ...]</span>
&lt;dict&gt; = {**&lt;dict&gt; [, ...]} <span class="hljs-comment"># Or: &lt;dict&gt; | ...</span>
</code></pre></div>
<pre><code class="python language-python hljs">head, *body, tail = &lt;coll.&gt; <span class="hljs-comment"># Head or tail can be omitted.</span>
<pre><code class="python language-python hljs">head, *body, tail = &lt;collection&gt; <span class="hljs-comment"># Head or tail can be omitted.</span>
</code></pre>
<div><h2 id="inline"><a href="#inline" name="inline">#</a>Inline</h2><div><h3 id="lambda">Lambda</h3><pre><code class="python language-python hljs">&lt;func&gt; = <span class="hljs-keyword">lambda</span>: &lt;return_value&gt; <span class="hljs-comment"># A single statement function.</span>
&lt;func&gt; = <span class="hljs-keyword">lambda</span> &lt;arg_1&gt;, &lt;arg_2&gt;: &lt;return_value&gt; <span class="hljs-comment"># Also allows default arguments.</span>
@ -683,22 +676,30 @@ func(*args, **kwargs)
<div><h3 id="conditionalexpression">Conditional Expression</h3><pre><code class="python language-python hljs">&lt;obj&gt; = &lt;exp&gt; <span class="hljs-keyword">if</span> &lt;condition&gt; <span class="hljs-keyword">else</span> &lt;exp&gt; <span class="hljs-comment"># Only one expression is evaluated.</span>
</code></pre></div>
<pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>[a <span class="hljs-keyword">if</span> a <span class="hljs-keyword">else</span> <span class="hljs-string">'zero'</span> <span class="hljs-keyword">for</span> a <span class="hljs-keyword">in</span> (<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>)] <span class="hljs-comment"># `any([0, '', [], None]) == False`</span>
<pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>[i <span class="hljs-keyword">if</span> i <span class="hljs-keyword">else</span> <span class="hljs-string">'zero'</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> (<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>)] <span class="hljs-comment"># `any([0, '', [], None]) == False`</span>
[<span class="hljs-string">'zero'</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]
</code></pre>
<div><h3 id="andor">And, Or</h3><pre><code class="python language-python hljs">&lt;obj&gt; = &lt;exp&gt; <span class="hljs-keyword">and</span> &lt;exp&gt; [<span class="hljs-keyword">and</span> ...] <span class="hljs-comment"># Returns first false or last operand.</span>
&lt;obj&gt; = &lt;exp&gt; <span class="hljs-keyword">or</span> &lt;exp&gt; [<span class="hljs-keyword">or</span> ...] <span class="hljs-comment"># Returns first true or last operand.</span>
</code></pre></div>
<div><h3 id="walrusoperator">Walrus Operator</h3><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>[i <span class="hljs-keyword">for</span> a <span class="hljs-keyword">in</span> <span class="hljs-string">'0123'</span> <span class="hljs-keyword">if</span> (i := int(a)) &gt; <span class="hljs-number">0</span>] <span class="hljs-comment"># Assigns to variable mid-sentence.</span>
[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]
</code></pre></div>
<div><h3 id="namedtupleenumdataclass">Named Tuple, Enum, Dataclass</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> collections <span class="hljs-keyword">import</span> namedtuple
Point = namedtuple(<span class="hljs-string">'Point'</span>, <span class="hljs-string">'x y'</span>) <span class="hljs-comment"># Creates a tuple's subclass.</span>
Point = namedtuple(<span class="hljs-string">'Point'</span>, <span class="hljs-string">'x y'</span>) <span class="hljs-comment"># Creates tuple's subclass.</span>
point = Point(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>) <span class="hljs-comment"># Returns its instance.</span>
</code></pre></div>
<pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
Direction = Enum(<span class="hljs-string">'Direction'</span>, <span class="hljs-string">'N E S W'</span>) <span class="hljs-comment"># Creates an enum.</span>
<span class="hljs-keyword">from</span> enum <span class="hljs-keyword">import</span> Enum
Direction = Enum(<span class="hljs-string">'Direction'</span>, <span class="hljs-string">'N E S W'</span>) <span class="hljs-comment"># Creates Enum's subclass.</span>
direction = Direction.N <span class="hljs-comment"># Returns its member.</span>
</code></pre>
<pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> dataclasses <span class="hljs-keyword">import</span> make_dataclass
<span class="hljs-keyword">from</span> dataclasses <span class="hljs-keyword">import</span> make_dataclass
Player = make_dataclass(<span class="hljs-string">'Player'</span>, [<span class="hljs-string">'loc'</span>, <span class="hljs-string">'dir'</span>]) <span class="hljs-comment"># Creates a class.</span>
player = Player(point, direction) <span class="hljs-comment"># Returns its instance.</span>
</code></pre>
</code></pre></div>
<div><h2 id="imports"><a href="#imports" name="imports">#</a>Imports</h2><p><strong>Mechanism that makes code in one file available to another file.</strong></p><pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> &lt;module&gt; <span class="hljs-comment"># Imports a built-in or '&lt;module&gt;.py'.</span>
<span class="hljs-keyword">import</span> &lt;package&gt; <span class="hljs-comment"># Imports a built-in or '&lt;package&gt;/__init__.py'.</span>
<span class="hljs-keyword">import</span> &lt;package&gt;.&lt;module&gt; <span class="hljs-comment"># Imports a built-in or '&lt;package&gt;/&lt;module&gt;.py'.</span>
@ -2944,7 +2945,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the active
<footer>
<aside>March 10, 2025</aside>
<aside>March 16, 2025</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

30
parse.js

@ -33,7 +33,7 @@ const TOC =
'<pre style="border-left: none;padding-left: 1.9px;"><code class="hljs bash" style="line-height: 1.327em;"><strong>ToC</strong> = {\n' +
' <strong><span class="hljs-string">\'1. Collections\'</span></strong>: [<a href="#list">List</a>, <a href="#dictionary">Dictionary</a>, <a href="#set">Set</a>, <a href="#tuple">Tuple</a>, <a href="#range">Range</a>, <a href="#enumerate">Enumerate</a>, <a href="#iterator">Iterator</a>, <a href="#generator">Generator</a>],\n' +
' <strong><span class="hljs-string">\'2. Types\'</span></strong>: [<a href="#type">Type</a>, <a href="#string">String</a>, <a href="#regex">Regular_Exp</a>, <a href="#format">Format</a>, <a href="#numbers">Numbers</a>, <a href="#combinatorics">Combinatorics</a>, <a href="#datetime">Datetime</a>],\n' +
' <strong><span class="hljs-string">\'3. Syntax\'</span></strong>: [<a href="#arguments">Args</a>, <a href="#inline">Inline</a>, <a href="#imports">Import</a>, <a href="#decorator">Decorator</a>, <a href="#class">Class</a>, <a href="#ducktypes">Duck_Types</a>, <a href="#enum">Enum</a>, <a href="#exceptions">Exception</a>],\n' +
' <strong><span class="hljs-string">\'3. Syntax\'</span></strong>: [<a href="#function">Function</a>, <a href="#inline">Inline</a>, <a href="#imports">Import</a>, <a href="#decorator">Decorator</a>, <a href="#class">Class</a>, <a href="#ducktypes">Duck_Type</a>, <a href="#enum">Enum</a>, <a href="#exceptions">Except</a>],\n' +
' <strong><span class="hljs-string">\'4. System\'</span></strong>: [<a href="#exit">Exit</a>, <a href="#print">Print</a>, <a href="#input">Input</a>, <a href="#commandlinearguments">Command_Line_Arguments</a>, <a href="#open">Open</a>, <a href="#paths">Path</a>, <a href="#oscommands">OS_Commands</a>],\n' +
' <strong><span class="hljs-string">\'5. Data\'</span></strong>: [<a href="#json">JSON</a>, <a href="#pickle">Pickle</a>, <a href="#csv">CSV</a>, <a href="#sqlite">SQLite</a>, <a href="#bytes">Bytes</a>, <a href="#struct">Struct</a>, <a href="#array">Array</a>, <a href="#memoryview">Memory_View</a>, <a href="#deque">Deque</a>],\n' +
' <strong><span class="hljs-string">\'6. Advanced\'</span></strong>: [<a href="#operator">Operator</a>, <a href="#matchstatement">Match_Stmt</a>, <a href="#logging">Logging</a>, <a href="#introspection">Introspection</a>, <a href="#threading">Threading</a>, <a href="#coroutines">Coroutines</a>],\n' +
@ -55,6 +55,13 @@ const CACHE =
'<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">fib</span><span class="hljs-params">(n)</span>:</span>\n' +
' <span class="hljs-keyword">return</span> n <span class="hljs-keyword">if</span> n &lt; <span class="hljs-number">2</span> <span class="hljs-keyword">else</span> fib(n-<span class="hljs-number">2</span>) + fib(n-<span class="hljs-number">1</span>)';
const SPLAT =
'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">add</span><span class="hljs-params">(*a)</span>:</span>\n' +
'<span class="hljs-meta">... </span> <span class="hljs-keyword">return</span> sum(a)\n' +
'<span class="hljs-meta">... </span>\n' +
'<span class="hljs-meta">&gt;&gt;&gt; </span>add(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>)\n' +
'<span class="hljs-number">6</span>\n';
const PARAMETRIZED_DECORATOR =
'<span class="hljs-keyword">from</span> functools <span class="hljs-keyword">import</span> wraps\n' +
'\n' +
@ -416,6 +423,19 @@ const DIAGRAM_5_A =
"| | {<float>:.2} | {<float>:.2f} | {<float>:.2e} | {<float>:.2%} |\n" +
"+--------------+----------------+----------------+----------------+----------------+\n";
const DIAGRAM_55_A =
"+--------------------+------------+--------------+----------------+------------------+\n";
const DIAGRAM_55_B =
'┏━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━┓\n' +
'┃ │ f(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>) │ f(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, z=<span class="hljs-number">3</span>) │ f(<span class="hljs-number">1</span>, y=<span class="hljs-number">2</span>, z=<span class="hljs-number">3</span>) │ f(x=<span class="hljs-number">1</span>, y=<span class="hljs-number">2</span>, z=<span class="hljs-number">3</span>) ┃\n' +
'┠────────────────────┼────────────┼──────────────┼────────────────┼──────────────────┨\n' +
'┃ <span class="hljs-title">f</span>(x, *args, **kw): │ ✓ │ ✓ │ ✓ │ ✓ ┃\n' +
'┃ <span class="hljs-title">f</span>(*args, z, **kw): │ │ ✓ │ ✓ │ ✓ ┃\n' +
'┃ <span class="hljs-title">f</span>(x, **kw): │ │ │ ✓ │ ✓ ┃\n' +
'┃ <span class="hljs-title">f</span>(*, x, **kw): │ │ │ │ ✓ ┃\n' +
'┗━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━┛\n';
const DIAGRAM_6_A =
'+------------+------------+------------+------------+--------------+\n' +
'| | Iterable | Collection | Sequence | abc.Sequence |\n' +
@ -690,7 +710,6 @@ const DIAGRAM_15_B =
"┃ │ c . . 6 7 │ │ │ treated as a column. ┃\n" +
"┗━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n";
const DIAGRAM_16_A =
'| df.apply(…) | x 4 | x y | x 4 |';
@ -854,6 +873,7 @@ function updateDiagrams() {
$(`code:contains(${DIAGRAM_2_A})`).html(DIAGRAM_2_B);
$(`code:contains(${DIAGRAM_4_A})`).html(DIAGRAM_4_B);
$(`code:contains(${DIAGRAM_5_A})`).parent().remove();
$(`code:contains(${DIAGRAM_55_A})`).html(DIAGRAM_55_B);
$(`code:contains(${DIAGRAM_6_A})`).html(DIAGRAM_6_B);
$(`code:contains(${DIAGRAM_7_A})`).html(DIAGRAM_7_B);
$(`code:contains(${DIAGRAM_8_A})`).html(DIAGRAM_8_B);
@ -904,18 +924,18 @@ function fixClasses() {
function fixHighlights() {
$(`code:contains(<int> = ±0b<bin>)`).html(BIN_HEX);
$(`code:contains( + fib(n)`).html(CACHE);
$(`code:contains(>>> def add)`).html(SPLAT);
$(`code:contains(@debug(print_result=True))`).html(PARAMETRIZED_DECORATOR);
$(`code:contains(print/str/repr([<obj>]))`).html(REPR_USE_CASES);
$(`code:contains((self, a=None):)`).html(CONSTRUCTOR_OVERLOADING);
$(`code:contains(shutil.copy)`).html(SHUTIL_COPY);
$(`code:contains(os.rename)`).html(OS_RENAME);
$(`code:contains(\'<n>s\')`).html(STRUCT_FORMAT);
$(`code:contains(match <object/expression>:)`).html(MATCH);
$(`code:contains(>>> match Path)`).html(MATCH_EXAMPLE);
$(`code:contains(>>> log.basicConfig()`).html(LOGGING_EXAMPLE);
$(`code:contains(import asyncio, collections, curses, curses.textpad, enum, random)`).html(COROUTINES);
$(`code:contains(import curses, os)`).html(CURSES);
$(`code:contains(pip3 install tqdm)`).html(PROGRESS_BAR);
$(`code:contains(>>> log.basicConfig()`).html(LOGGING_EXAMPLE);
$(`code:contains(import curses, os)`).html(CURSES);
$(`code:contains(a_float = max()`).html(AUDIO_1);
$(`code:contains(samples_f = (sin(i *)`).html(AUDIO_2);
$(`code:contains(collections, dataclasses, enum, io, itertools)`).html(MARIO);

16
pdf/index_for_pdf.html

@ -7,7 +7,7 @@
<p><strong>abstract base classes, <a href="#abstractbaseclasses">4</a>, <a href="#abcsequence">19</a></strong><br>
<strong>animation, <a href="#animation">40</a>, <a href="#pygame">42</a>-<a href="#basicmariobrothersexample">43</a></strong><br>
<strong>argparse module, <a href="#argumentparser">22</a></strong><br>
<strong>arguments, <a href="#arguments">10</a>, <a href="#partial">12</a>, <a href="#commandlinearguments">22</a></strong><br>
<strong>arguments, <a href="#function">10</a>, <a href="#partial">12</a>, <a href="#commandlinearguments">22</a></strong><br>
<strong>arrays, <a href="#array">29</a>, <a href="#numpy">37</a>-<a href="#indexing">38</a></strong><br>
<strong>asyncio module, <a href="#coroutines">33</a></strong><br>
<strong>audio, <a href="#audio">40</a>-<a href="#synthesizer">41</a>, <a href="#sound">42</a></strong> </p>
@ -34,11 +34,11 @@
<strong>curses module, <a href="#runsaterminalgamewhereyoucontrolanasteriskthatmustavoidnumbers">33</a>, <a href="#consoleapp">34</a></strong><br>
<strong>cython, <a href="#typeannotations">15</a>, <a href="#cython">49</a></strong> </p>
<h3 id="d">D</h3>
<p><strong>dataclasses module, <a href="#namedtupleenumdataclass">12</a>, <a href="#dataclass">15</a></strong><br>
<p><strong>dataclasses module, <a href="#namedtupleenumdataclass">11</a>, <a href="#dataclass">15</a></strong><br>
<strong>datetime module, <a href="#datetime">8</a>-<a href="#now">9</a></strong><br>
<strong>decorator, <a href="#decorator">13</a>, <a href="#class">14</a>, <a href="#dataclass">15</a>, <a href="#sortable">16</a></strong><br>
<strong>deques, <a href="#deque">29</a></strong><br>
<strong>dictionaries, <a href="#dictionary">2</a>, <a href="#abstractbaseclasses">4</a>, <a href="#otheruses">11</a>, <a href="#tableofrequiredandautomaticallyavailablespecialmethods">19</a>, <a href="#collectionsandtheirexceptions">21</a></strong><br>
<strong>dictionaries, <a href="#dictionary">2</a>, <a href="#abstractbaseclasses">4</a>, <a href="#otheruses">10</a>-<a href="#comprehensions">11</a>, <a href="#tableofrequiredandautomaticallyavailablespecialmethods">19</a>, <a href="#collectionsandtheirexceptions">21</a></strong><br>
<strong>duck types, <a href="#ducktypes">16</a>-<a href="#abcsequence">19</a></strong> </p>
<h3 id="e">E</h3>
<p><strong>enum module, <a href="#enum">19</a>-<a href="#inline-1">20</a></strong><br>
@ -64,7 +64,7 @@
<h3 id="i">I</h3>
<p><strong>image, <a href="#scrapespythonsurlandlogofromitswikipediapage">35</a>, <a href="#image">39</a>-<a href="#animation">40</a>, <a href="#surface">42</a>-<a href="#basicmariobrothersexample">43</a></strong><br>
<strong>imports, <a href="#imports">12</a></strong><br>
<strong>inline, <a href="#otheruses">11</a>, <a href="#dataclass">15</a>, <a href="#inline-1">20</a></strong><br>
<strong>inline, <a href="#inline">11</a>, <a href="#dataclass">15</a>, <a href="#inline-1">20</a></strong><br>
<strong>input function, <a href="#input">22</a></strong><br>
<strong>introspection, <a href="#exceptionobject">21</a>, <a href="#introspection">31</a></strong><br>
<strong>ints, <a href="#abstractbaseclasses">4</a>, <a href="#ints">7</a>-<a href="#random">8</a>, <a href="#encode-1">28</a></strong><br>
@ -76,7 +76,7 @@
<p><strong>json, <a href="#json">25</a>, <a href="#restrequest">36</a>, <a href="#fileformats">46</a></strong> </p>
<h3 id="l">L</h3>
<p><strong>lambda, <a href="#lambda">11</a></strong><br>
<strong>lists, <a href="#list">1</a>-<a href="#list">2</a>, <a href="#abstractbaseclasses">4</a>, <a href="#otheruses">11</a>, <a href="#sequence">18</a>-<a href="#abcsequence">19</a>, <a href="#collectionsandtheirexceptions">21</a></strong><br>
<strong>lists, <a href="#list">1</a>-<a href="#list">2</a>, <a href="#abstractbaseclasses">4</a>, <a href="#otheruses">10</a>-<a href="#comprehensions">11</a>, <a href="#sequence">18</a>-<a href="#abcsequence">19</a>, <a href="#collectionsandtheirexceptions">21</a></strong><br>
<strong>locale module, <a href="#sortable">16</a></strong><br>
<strong>logging, <a href="#logging">31</a></strong> </p>
<h3 id="m">M</h3>
@ -121,11 +121,11 @@
<p><strong>scope, <a href="#insidefunctiondefinition">10</a>, <a href="#nonlocal">12</a>, <a href="#complexexample">20</a></strong><br>
<strong>scraping, <a href="#scraping">35</a>, <a href="#basicmariobrothersexample">43</a>, <a href="#fileformats">46</a>, <a href="#displaysalinechartoftotalcoronavirusdeathspermilliongroupedbycontinent">47</a>-<a href="#displaysamultiaxislinechartoftotalcoronaviruscasesandchangesinpricesofbitcoindowjonesandgold">48</a></strong><br>
<strong>sequence, <a href="#abstractbaseclasses">4</a>, <a href="#sequence">18</a>-<a href="#abcsequence">19</a></strong><br>
<strong>sets, <a href="#set">2</a>, <a href="#abstractbaseclasses">4</a>, <a href="#otheruses">11</a>, <a href="#tableofrequiredandautomaticallyavailablespecialmethods">19</a>, <a href="#collectionsandtheirexceptions">21</a></strong><br>
<strong>sets, <a href="#set">2</a>, <a href="#abstractbaseclasses">4</a>, <a href="#otheruses">10</a>-<a href="#comprehensions">11</a>, <a href="#tableofrequiredandautomaticallyavailablespecialmethods">19</a>, <a href="#collectionsandtheirexceptions">21</a></strong><br>
<strong>shell commands, <a href="#shellcommands">25</a></strong><br>
<strong>sleep function, <a href="#progressbar">34</a></strong><br>
<strong>sortable, <a href="#list">1</a>, <a href="#sortable">16</a></strong><br>
<strong>splat operator, <a href="#splatoperator">10</a>-<a href="#otheruses">11</a>, <a href="#readrowsfromcsvfile">26</a></strong><br>
<strong>splat operator, <a href="#splatoperator">10</a>, <a href="#readrowsfromcsvfile">26</a></strong><br>
<strong>sql, <a href="#sqlite">27</a>, <a href="#fileformats">46</a></strong><br>
<strong>statistics, <a href="#statistics">7</a>, <a href="#numpy">37</a>-<a href="#indexing">38</a>, <a href="#pandas">44</a>-<a href="#displaysamultiaxislinechartoftotalcoronaviruscasesandchangesinpricesofbitcoindowjonesandgold">48</a></strong><br>
<strong>strings, <a href="#abstractbaseclasses">4</a>-<a href="#comparisonofpresentationtypes">7</a>, <a href="#class">14</a></strong><br>
@ -138,7 +138,7 @@
<strong>template, <a href="#format">6</a>, <a href="#dynamicrequest">36</a></strong><br>
<strong>threading module, <a href="#threading">32</a>, <a href="#startstheappinitsownthreadandqueriesitsrestapi">36</a></strong><br>
<strong>time module, <a href="#progressbar">34</a>, <a href="#profiling">36</a></strong><br>
<strong>tuples, <a href="#tuple">3</a>, <a href="#abstractbaseclasses">4</a>, <a href="#otheruses">11</a>, <a href="#sequence">18</a>-<a href="#abcsequence">19</a></strong><br>
<strong>tuples, <a href="#tuple">3</a>, <a href="#abstractbaseclasses">4</a>, <a href="#otheruses">10</a>-<a href="#comprehensions">11</a>, <a href="#sequence">18</a>-<a href="#abcsequence">19</a></strong><br>
<strong>type, <a href="#type">4</a>, <a href="#ducktypes">16</a>, <a href="#matchstatement">30</a></strong><br>
<strong>type annotations, <a href="#typeannotations">15</a>, <a href="#introspection">31</a></strong> </p>
<h3 id="w">W</h3>

12
pdf/index_for_pdf_print.html

@ -34,11 +34,11 @@
<strong>curses module, 33, 34</strong><br>
<strong>cython, 15, 49</strong> </p>
<h3 id="d">D</h3>
<p><strong>dataclasses module, 12, 15</strong><br>
<p><strong>dataclasses module, 11, 15</strong><br>
<strong>datetime module, 8-9</strong><br>
<strong>decorator, 13, 14, 15, 16</strong><br>
<strong>deques, 29</strong><br>
<strong>dictionaries, 2, 4, 11, 19, 21</strong><br>
<strong>dictionaries, 2, 4, 10-11, 19, 21</strong><br>
<strong>duck types, 16-19</strong> </p>
<h3 id="e">E</h3>
<p><strong>enum module, 19-20</strong><br>
@ -76,7 +76,7 @@
<p><strong>json, 25, 36, 46</strong> </p>
<h3 id="l">L</h3>
<p><strong>lambda, 11</strong><br>
<strong>lists, 1-2, 4, 11, 18-19, 21</strong><br>
<strong>lists, 1-2, 4, 10-11, 18-19, 21</strong><br>
<strong>locale module, 16</strong><br>
<strong>logging, 31</strong> </p>
<h3 id="m">M</h3>
@ -121,11 +121,11 @@
<p><strong>scope, 10, 12, 20</strong><br>
<strong>scraping, 35, 43, 46, 47-48</strong><br>
<strong>sequence, 4, 18-19</strong><br>
<strong>sets, 2, 4, 11, 19, 21</strong><br>
<strong>sets, 2, 4, 10-11, 19, 21</strong><br>
<strong>shell commands, 25</strong><br>
<strong>sleep function, 34</strong><br>
<strong>sortable, 1, 16</strong><br>
<strong>splat operator, 10-11, 26</strong><br>
<strong>splat operator, 10, 26</strong><br>
<strong>sql, 27, 46</strong><br>
<strong>statistics, 7, 37-38, 44-48</strong><br>
<strong>strings, 4-7, 14</strong><br>
@ -138,7 +138,7 @@
<strong>template, 6, 36</strong><br>
<strong>threading module, 32, 36</strong><br>
<strong>time module, 34, 36</strong><br>
<strong>tuples, 3, 4, 11, 18-19</strong><br>
<strong>tuples, 3, 4, 10-11, 18-19</strong><br>
<strong>type, 4, 16, 30</strong><br>
<strong>type annotations, 15, 31</strong> </p>
<h3 id="w">W</h3>

4
web/script_2.js

@ -2,7 +2,7 @@ const TOC =
'<strong>ToC</strong> = {\n' +
' <strong><span class="hljs-string">\'1. Collections\'</span></strong>: [<a href="#list">List</a>, <a href="#dictionary">Dictionary</a>, <a href="#set">Set</a>, <a href="#tuple">Tuple</a>, <a href="#range">Range</a>, <a href="#enumerate">Enumerate</a>, <a href="#iterator">Iterator</a>, <a href="#generator">Generator</a>],\n' +
' <strong><span class="hljs-string">\'2. Types\'</span></strong>: [<a href="#type">Type</a>, <a href="#string">String</a>, <a href="#regex">Regular_Exp</a>, <a href="#format">Format</a>, <a href="#numbers">Numbers</a>, <a href="#combinatorics">Combinatorics</a>, <a href="#datetime">Datetime</a>],\n' +
' <strong><span class="hljs-string">\'3. Syntax\'</span></strong>: [<a href="#arguments">Args</a>, <a href="#inline">Inline</a>, <a href="#imports">Import</a>, <a href="#decorator">Decorator</a>, <a href="#class">Class</a>, <a href="#ducktypes">Duck_Types</a>, <a href="#enum">Enum</a>, <a href="#exceptions">Exception</a>],\n' +
' <strong><span class="hljs-string">\'3. Syntax\'</span></strong>: [<a href="#function">Function</a>, <a href="#inline">Inline</a>, <a href="#imports">Import</a>, <a href="#decorator">Decorator</a>, <a href="#class">Class</a>, <a href="#ducktypes">Duck_Type</a>, <a href="#enum">Enum</a>, <a href="#exceptions">Except</a>],\n' +
' <strong><span class="hljs-string">\'4. System\'</span></strong>: [<a href="#exit">Exit</a>, <a href="#print">Print</a>, <a href="#input">Input</a>, <a href="#commandlinearguments">Command_Line_Arguments</a>, <a href="#open">Open</a>, <a href="#paths">Path</a>, <a href="#oscommands">OS_Commands</a>],\n' +
' <strong><span class="hljs-string">\'5. Data\'</span></strong>: [<a href="#json">JSON</a>, <a href="#pickle">Pickle</a>, <a href="#csv">CSV</a>, <a href="#sqlite">SQLite</a>, <a href="#bytes">Bytes</a>, <a href="#struct">Struct</a>, <a href="#array">Array</a>, <a href="#memoryview">Memory_View</a>, <a href="#deque">Deque</a>],\n' +
' <strong><span class="hljs-string">\'6. Advanced\'</span></strong>: [<a href="#operator">Operator</a>, <a href="#matchstatement">Match_Stmt</a>, <a href="#logging">Logging</a>, <a href="#introspection">Introspection</a>, <a href="#threading">Threading</a>, <a href="#coroutines">Coroutines</a>],\n' +
@ -18,7 +18,7 @@ const TOC_MOBILE =
' <strong><span class="hljs-string">\'2. Types\'</span></strong>: [<a href="#type">Type</a>, <a href="#string">String</a>, <a href="#regex">Regular_Exp</a>,\n' +
' <a href="#format">Format</a>, <a href="#numbers">Numbers</a>,\n' +
' <a href="#combinatorics">Combinatorics</a>, <a href="#datetime">Datetime</a>],\n' +
' <strong><span class="hljs-string">\'3. Syntax\'</span></strong>: [<a href="#arguments">Arguments</a>, <a href="#inline">Inline</a>, <a href="#imports">Import</a>,\n' +
' <strong><span class="hljs-string">\'3. Syntax\'</span></strong>: [<a href="#function">Function</a>, <a href="#inline">Inline</a>, <a href="#imports">Import</a>,\n' +
' <a href="#decorator">Decorator</a>, <a href="#class">Class</a>,\n' +
' <a href="#ducktypes">Duck_Types</a>, <a href="#enum">Enum</a>, <a href="#exceptions">Except</a>],\n' +
' <strong><span class="hljs-string">\'4. System\'</span></strong>: [<a href="#exit">Exit</a>, <a href="#print">Print</a>, <a href="#input">Input</a>,\n' +

Loading…
Cancel
Save