Skip to content

Commit

Permalink
deploy: e20bb87
Browse files Browse the repository at this point in the history
  • Loading branch information
baniasbaabe committed Jan 30, 2024
1 parent 436319c commit 7d2451f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
26 changes: 26 additions & 0 deletions _sources/book/pythontricks/Chapter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,32 @@
"for sport in sports:\n",
" print(sport, end=\" \")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Type Variables in Python 3.12"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"class Stack[T]:\n",
" def __init__(self) -> None:\n",
" self.items: List[T] = []\n",
"\n",
" def push(self, item: T) -> None:\n",
" self.items.append(item)"
]
}
],
"metadata": {
Expand Down
17 changes: 17 additions & 0 deletions book/pythontricks/Chapter.html
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ <h2> Contents </h2>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#mutable-default-values-for-function-arguments">10.1.21. Mutable Default Values for Function Arguments</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#optimize-your-python-objects-with-slots">10.1.22. Optimize Your Python Objects with <code class="docutils literal notranslate"><span class="pre">__slots__</span></code></a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#modify-print-statements">10.1.23. Modify Print Statements</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#type-variables-in-python-3-12">10.1.24. Type Variables in Python 3.12</a></li>
</ul>
</nav>
</div>
Expand Down Expand Up @@ -1011,6 +1012,21 @@ <h2><span class="section-number">10.1.23. </span>Modify Print Statements<a class
</div>
</div>
</section>
<section id="type-variables-in-python-3-12">
<h2><span class="section-number">10.1.24. </span>Type Variables in Python 3.12<a class="headerlink" href="#type-variables-in-python-3-12" title="Permalink to this heading">#</a></h2>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">Stack</span><span class="p">[</span><span class="n">T</span><span class="p">]:</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">items</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="n">T</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>

<span class="k">def</span> <span class="nf">push</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">:</span> <span class="n">T</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">items</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
</section>
</section>

<script type="text/x-thebe-config">
Expand Down Expand Up @@ -1103,6 +1119,7 @@ <h2><span class="section-number">10.1.23. </span>Modify Print Statements<a class
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#mutable-default-values-for-function-arguments">10.1.21. Mutable Default Values for Function Arguments</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#optimize-your-python-objects-with-slots">10.1.22. Optimize Your Python Objects with <code class="docutils literal notranslate"><span class="pre">__slots__</span></code></a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#modify-print-statements">10.1.23. Modify Print Statements</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#type-variables-in-python-3-12">10.1.24. Type Variables in Python 3.12</a></li>
</ul>
</nav></div>

Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 7d2451f

Please sign in to comment.