Browse Source

Arguments

pull/135/head
Jure Šorn 2 years ago
parent
commit
96d976786e
3 changed files with 9 additions and 9 deletions
  1. 6
      README.md
  2. 10
      index.html
  3. 2
      pdf/remove_links.py

6
README.md

@ -679,8 +679,8 @@ def f(<nondefault_args>): # def f(x, y):
def f(<default_args>): # def f(x=0, y=0):
def f(<nondefault_args>, <default_args>): # def f(x, y=0):
```
* **A function has its default values evaluated when it's first encountered in the scope.**
* **Any changes to default values that are mutable will persist between invocations.**
* **Value of a default argument is evaluated when function is first encountered in the scope.**
* **If this value is a mutable object, then all its mutations will persist between invocations.**
Splat Operator
@ -1814,8 +1814,8 @@ import csv
<list> = list(<reader>) # Returns a list of remaining rows.
```
* **File must be opened with a `'newline=""'` argument, or newlines embedded inside quoted fields will not be interpreted correctly!**
* **For XML and binary Excel files (xlsx, xlsm and xlsb) use [Pandas](#dataframe-plot-encode-decode) library.**
* **To print the table to the console use [Tabulate](#table) library.**
* **For XML and binary Excel files (xlsx, xlsm and xlsb) use [Pandas](#dataframe-plot-encode-decode) library.**
### Write
```python

10
index.html

@ -54,7 +54,7 @@
<body>
<header>
<aside>June 17, 2022</aside>
<aside>June 19, 2022</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header>
@ -601,8 +601,8 @@ to_exclusive = &lt;range&gt;.stop
</code></pre></div>
<ul>
<li><strong>A function has its default values evaluated when it's first encountered in the scope.</strong></li>
<li><strong>Any changes to default values that are mutable will persist between invocations.</strong></li>
<li><strong>Value of a default argument is evaluated when function is first encountered in the scope.</strong></li>
<li><strong>If this value is a mutable object, then all its mutations 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>}
@ -1513,8 +1513,8 @@ CompletedProcess(args=[<span class="hljs-string">'bc'</span>, <span class="hljs-
<ul>
<li><strong>File must be opened with a <code class="python hljs"><span class="hljs-string">'newline=""'</span></code> argument, or newlines embedded inside quoted fields will not be interpreted correctly!</strong></li>
<li><strong>For XML and binary Excel files (xlsx, xlsm and xlsb) use <a href="#dataframeplotencodedecode">Pandas</a> library.</strong></li>
<li><strong>To print the table to the console use <a href="#table">Tabulate</a> library.</strong></li>
<li><strong>For XML and binary Excel files (xlsx, xlsm and xlsb) use <a href="#dataframeplotencodedecode">Pandas</a> library.</strong></li>
</ul>
<div><h3 id="write">Write</h3><pre><code class="python language-python hljs">&lt;writer&gt; = csv.writer(&lt;file&gt;) <span class="hljs-comment"># Also: `dialect='excel', delimiter=','`.</span>
&lt;writer&gt;.writerow(&lt;collection&gt;) <span class="hljs-comment"># Encodes objects using `str(&lt;el&gt;)`.</span>
@ -2902,7 +2902,7 @@ $ pyinstaller script.py --add-data '&lt;path&gt;:.' <span class="hljs-comment">
<footer>
<aside>June 17, 2022</aside>
<aside>June 19, 2022</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer>

2
pdf/remove_links.py

@ -17,7 +17,7 @@ MATCHES = {
'<strong>Generators returned by the <a href="#generator">generator functions</a> and <a href="#comprehensions">generator expressions</a>.</strong>': '<strong>Generators returned by the generator functions (p. 4) and generator expressions (p. 11).</strong>',
'<strong>File objects returned by the <a href="#open">open()</a> function, etc.</strong>': '<strong>File objects returned by the open() function (p. 22), etc.</strong>',
'<strong>Functions report OS related errors by raising either OSError or one of its <a href="#exceptions-1">subclasses</a>.</strong>': '<strong>Functions report OS related errors by raising OSError or one of its subclasses (p. 23).</strong>',
'<strong>To print the table to console use <a href="#table">Tabulate</a> library.</strong>': '<strong>To print the table to console use Tabulate library (p. 34).</strong>',
'<strong>To print the table to the console use <a href="#table">Tabulate</a> library.</strong>': '<strong>To print the table to the console use Tabulate library (p. 34).</strong>',
'<strong>For XML and binary Excel files (xlsx, xlsm and xlsb) use <a href="#dataframeplotencodedecode">Pandas</a> library.</strong>': '<strong>For XML and binary Excel files (xlsx, xlsm and xlsb) use Pandas library (p. 46).</strong>',
'<strong>Bools will be stored and returned as ints and dates as <a href="#encode">ISO formatted strings</a>.</strong>': '<strong>Bools will be stored and returned as ints and dates as ISO formatted strings (p. 9).</strong>',
'<strong>An object with the same interface called ProcessPoolExecutor provides true parallelism by running a separate interpreter in each process. All arguments must be <a href="#pickle">pickable</a>.</strong>': '<strong>An object with the same interface called ProcessPoolExecutor provides true parallelism by running a separate interpreter in each process. All arguments must be pickable (p. 25).</strong>',

Loading…
Cancel
Save