Browse Source

Match statement

pull/116/merge
Jure Šorn 2 months ago
parent
commit
f2b1e8ab1f
2 changed files with 2 additions and 2 deletions
  1. 2
      README.md
  2. 2
      index.html

2
README.md

@ -2204,8 +2204,8 @@ match <object/expression>:
<class_pattern> = <type>() # Matches any object of that type. <class_pattern> = <type>() # Matches any object of that type.
<wildcard_patt> = _ # Matches any object. <wildcard_patt> = _ # Matches any object.
<capture_patt> = <name> # Matches any object and binds it to name. <capture_patt> = <name> # Matches any object and binds it to name.
<or_pattern> = <pattern> | <pattern> [| ...] # Matches any of the patterns.
<as_pattern> = <pattern> as <name> # Binds match to name. Also <type>(<name>). <as_pattern> = <pattern> as <name> # Binds match to name. Also <type>(<name>).
<or_pattern> = <pattern> | <pattern> [| ...] # Matches any of the patterns.
<sequence_patt> = [<pattern>, ...] # Matches sequence with matching items. <sequence_patt> = [<pattern>, ...] # Matches sequence with matching items.
<mapping_patt> = {<value_pattern>: <patt>, ...} # Matches dictionary with matching items. <mapping_patt> = {<value_pattern>: <patt>, ...} # Matches dictionary with matching items.
<class_pattern> = <type>(<attr_name>=<patt>, ...) # Matches object with matching attributes. <class_pattern> = <type>(<attr_name>=<patt>, ...) # Matches object with matching attributes.

2
index.html

@ -1808,8 +1808,8 @@ first_element = op.methodcaller(<span class="hljs-string">'pop'</span>, <span
&lt;class_pattern&gt; = &lt;type&gt;() <span class="hljs-comment"># Matches any object of that type.</span> &lt;class_pattern&gt; = &lt;type&gt;() <span class="hljs-comment"># Matches any object of that type.</span>
&lt;wildcard_patt&gt; = _ <span class="hljs-comment"># Matches any object.</span> &lt;wildcard_patt&gt; = _ <span class="hljs-comment"># Matches any object.</span>
&lt;capture_patt&gt; = &lt;name&gt; <span class="hljs-comment"># Matches any object and binds it to name.</span> &lt;capture_patt&gt; = &lt;name&gt; <span class="hljs-comment"># Matches any object and binds it to name.</span>
&lt;or_pattern&gt; = &lt;pattern&gt; | &lt;pattern&gt; [| ...] <span class="hljs-comment"># Matches any of the patterns.</span>
&lt;as_pattern&gt; = &lt;pattern&gt; <span class="hljs-keyword">as</span> &lt;name&gt; <span class="hljs-comment"># Binds match to name. Also &lt;type&gt;(&lt;name&gt;).</span> &lt;as_pattern&gt; = &lt;pattern&gt; <span class="hljs-keyword">as</span> &lt;name&gt; <span class="hljs-comment"># Binds match to name. Also &lt;type&gt;(&lt;name&gt;).</span>
&lt;or_pattern&gt; = &lt;pattern&gt; | &lt;pattern&gt; [| ...] <span class="hljs-comment"># Matches any of the patterns.</span>
&lt;sequence_patt&gt; = [&lt;pattern&gt;, ...] <span class="hljs-comment"># Matches sequence with matching items.</span> &lt;sequence_patt&gt; = [&lt;pattern&gt;, ...] <span class="hljs-comment"># Matches sequence with matching items.</span>
&lt;mapping_patt&gt; = {&lt;value_pattern&gt;: &lt;patt&gt;, ...} <span class="hljs-comment"># Matches dictionary with matching items.</span> &lt;mapping_patt&gt; = {&lt;value_pattern&gt;: &lt;patt&gt;, ...} <span class="hljs-comment"># Matches dictionary with matching items.</span>
&lt;class_pattern&gt; = &lt;type&gt;(&lt;attr_name&gt;=&lt;patt&gt;, ...) <span class="hljs-comment"># Matches object with matching attributes.</span> &lt;class_pattern&gt; = &lt;type&gt;(&lt;attr_name&gt;=&lt;patt&gt;, ...) <span class="hljs-comment"># Matches object with matching attributes.</span>

Loading…
Cancel
Save