Browse Source

Arguments

pull/140/head
Jure Šorn 1 year ago
parent
commit
01eb6f2f27
2 changed files with 2 additions and 2 deletions
  1. 2
      README.md
  2. 2
      index.html

2
README.md

@ -679,7 +679,7 @@ def func(<default_args>): ... # def func(x=0, y=0): ...
def func(<nondefault_args>, <default_args>): ... # def func(x, 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.**
* **Any mutation of a mutable default value will persist between invocations!**
Splat Operator

2
index.html

@ -601,7 +601,7 @@ func(&lt;positional_args&gt;, &lt;keyword_args&gt;) <span class="hljs-
<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>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>}

Loading…
Cancel
Save