Browse Source

Splat operator

pull/38/merge
Jure Šorn 5 years ago
parent
commit
f1609d19bb
2 changed files with 6 additions and 6 deletions
  1. 8
      README.md
  2. 4
      index.html

8
README.md

@ -724,10 +724,6 @@ def f(x, *args, z, **kwargs): # f(x=1, y=2, z=3) | f(1, y=2, z=3) | f(1, 2, z=3
``` ```
### Other Uses ### Other Uses
```python
head, *body, tail = <collection>
```
```python ```python
<list> = [*<collection> [, ...]] <list> = [*<collection> [, ...]]
<set> = {*<collection> [, ...]} <set> = {*<collection> [, ...]}
@ -735,6 +731,10 @@ head, *body, tail = <collection>
<dict> = {**<dict> [, ...]} <dict> = {**<dict> [, ...]}
``` ```
```python
head, *body, tail = <collection>
```
Inline Inline
------ ------

4
index.html

@ -732,13 +732,13 @@ func(*args, **kwargs)
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(x, *args, z, **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)</span> <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span><span class="hljs-params">(x, *args, z, **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)</span>
</code></pre> </code></pre>
<h3 id="otheruses">Other Uses</h3> <h3 id="otheruses">Other Uses</h3>
<pre><code class="python language-python hljs">head, *body, tail = &lt;collection&gt;
</code></pre>
<pre><code class="python language-python hljs">&lt;list&gt; = [*&lt;collection&gt; [, ...]] <pre><code class="python language-python hljs">&lt;list&gt; = [*&lt;collection&gt; [, ...]]
&lt;set&gt; = {*&lt;collection&gt; [, ...]} &lt;set&gt; = {*&lt;collection&gt; [, ...]}
&lt;tuple&gt; = (*&lt;collection&gt;, [...]) &lt;tuple&gt; = (*&lt;collection&gt;, [...])
&lt;dict&gt; = {**&lt;dict&gt; [, ...]} &lt;dict&gt; = {**&lt;dict&gt; [, ...]}
</code></pre> </code></pre>
<pre><code class="python language-python hljs">head, *body, tail = &lt;collection&gt;
</code></pre>
<h2 id="inline"><a href="#inline" name="inline">#</a>Inline</h2> <h2 id="inline"><a href="#inline" name="inline">#</a>Inline</h2>
<h3 id="lambda">Lambda</h3> <h3 id="lambda">Lambda</h3>
<pre><code class="python language-python hljs">&lt;function&gt; = <span class="hljs-keyword">lambda</span>: &lt;return_value&gt; <pre><code class="python language-python hljs">&lt;function&gt; = <span class="hljs-keyword">lambda</span>: &lt;return_value&gt;

Loading…
Cancel
Save