Browse Source

Operator

pull/188/head
Jure Šorn 7 months ago
parent
commit
701fa8a978
2 changed files with 2 additions and 2 deletions
  1. 2
      README.md
  2. 2
      index.html

2
README.md

@ -2183,8 +2183,8 @@ sorted_by_both = sorted(<coll.>, key=op.itemgetter(1, 0))
product_of_elems = functools.reduce(op.mul, <collection>)
first_element = op.methodcaller('pop', 0)(<list>)
```
* **Comparisons can be chained: `'x < y < z'` is the same as `'(x < y) and (y < z)`'.**
* **Most operators call the object's special method that is named after them (second object is passed as an argument), while logical operators call their own code that relies on bool().**
* **Comparisons can be chained: `'x < y < z'` is the same as `'(x < y) and (y < z)`'.**
Match Statement

2
index.html

@ -1794,8 +1794,8 @@ product_of_elems = functools.reduce(op.mul, &lt;collection&gt;)
first_element = op.methodcaller(<span class="hljs-string">'pop'</span>, <span class="hljs-number">0</span>)(&lt;list&gt;)
</code></pre>
<ul>
<li><strong>Comparisons can be chained: <code class="python hljs"><span class="hljs-string">'x &lt; y &lt; z'</span></code> is the same as <code class="python hljs"><span class="hljs-string">'(x &lt; y) and (y &lt; z)</span></code>'.</strong></li>
<li><strong>Most operators call the object's special method that is named after them (second object is passed as an argument), while logical operators call their own code that relies on bool().</strong></li>
<li><strong>Comparisons can be chained: <code class="python hljs"><span class="hljs-string">'x &lt; y &lt; z'</span></code> is the same as <code class="python hljs"><span class="hljs-string">'(x &lt; y) and (y &lt; z)</span></code>'.</strong></li>
</ul>
<div><h2 id="matchstatement"><a href="#matchstatement" name="matchstatement">#</a>Match Statement</h2><p><strong>Executes the first block with matching pattern. Added in Python 3.10.</strong></p><pre><code class="python language-python hljs"><span class="hljs-keyword">match</span> &lt;object/expression&gt;:
<span class="hljs-keyword">case</span> &lt;pattern&gt; [<span class="hljs-keyword">if</span> &lt;condition&gt;]:

Loading…
Cancel
Save