Browse Source

Operator

pull/52/head
Jure Šorn 4 years ago
parent
commit
9636f6f75a
4 changed files with 8 additions and 6 deletions
  1. 3
      README.md
  2. 3
      index.html
  3. 4
      web/index_for_pdf.html
  4. 4
      web/index_for_pdf_print.html

3
README.md

@ -2095,9 +2095,10 @@ from operator import itemgetter, attrgetter, methodcaller
```python
import operator as op
elementwise_sum = map(op.add, list_a, list_b)
product_of_elems = functools.reduce(op.mul, <collection>)
sorted_by_second = sorted(<collection>, key=op.itemgetter(1))
sorted_by_both = sorted(<collection>, key=op.itemgetter(1, 0))
product_of_elems = functools.reduce(op.mul, <collection>)
LogicOp = enum.Enum('LogicOp', {'AND': op.and_, 'OR' : op.or_})
last_el = op.methodcaller('pop')(<list>)
```

3
index.html

@ -1840,9 +1840,10 @@ lock.release()
<pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> operator <span class="hljs-keyword">as</span> op
elementwise_sum = map(op.add, list_a, list_b)
product_of_elems = functools.reduce(op.mul, &lt;collection&gt;)
sorted_by_second = sorted(&lt;collection&gt;, key=op.itemgetter(<span class="hljs-number">1</span>))
sorted_by_both = sorted(&lt;collection&gt;, key=op.itemgetter(<span class="hljs-number">1</span>, <span class="hljs-number">0</span>))
product_of_elems = functools.reduce(op.mul, &lt;collection&gt;)
LogicOp = enum.Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-string">'AND'</span>: op.and_, <span class="hljs-string">'OR'</span> : op.or_})
last_el = op.methodcaller(<span class="hljs-string">'pop'</span>)(&lt;list&gt;)
</code></pre>

4
web/index_for_pdf.html

@ -81,7 +81,7 @@
<strong>logging, <a href="#logging">35</a></strong> </p>
<h3 id="m">M</h3>
<p><strong>main function, <a href="#main">1</a>, <a href="#basicscripttemplate">41</a></strong><br>
<strong>map function, <a href="#mapfilterreduce">11</a></strong><br>
<strong>map function, <a href="#mapfilterreduce">11</a>, <a href="#operator">31</a></strong><br>
<strong>math module, <a href="#math">7</a></strong><br>
<strong>memoryviews, <a href="#memoryview">29</a></strong><br>
<strong>metaclass attribute, <a href="#metaclassattribute">32</a></strong><br>
@ -113,7 +113,7 @@
<p><strong>random module, <a href="#random">8</a></strong><br>
<strong>ranges, <a href="#range">3</a></strong><br>
<strong>recursion, <a href="#lrucache">13</a></strong><br>
<strong>reduce function, <a href="#mapfilterreduce">11</a></strong><br>
<strong>reduce function, <a href="#mapfilterreduce">11</a>, <a href="#operator">31</a></strong><br>
<strong>regular expressions, <a href="#regex">5</a>-<a href="#specialsequences">6</a></strong><br>
<strong>requests library, <a href="#scraping">35</a>, <a href="#test">36</a></strong> </p>
<h3 id="s">S</h3>

4
web/index_for_pdf_print.html

@ -85,7 +85,7 @@
<strong>logging, 35</strong> </p>
<h3 id="m">M</h3>
<p><strong>main function, 1, 41</strong><br>
<strong>map function, 11</strong><br>
<strong>map function, 11, 31</strong><br>
<strong>math module, 7</strong><br>
<strong>memoryviews, 29</strong><br>
<strong>metaclass attribute, 32</strong><br>
@ -117,7 +117,7 @@
<p><strong>random module, 8</strong><br>
<strong>ranges, 3</strong><br>
<strong>recursion, 13</strong><br>
<strong>reduce function, 11</strong><br>
<strong>reduce function, 11, 31</strong><br>
<strong>regular expressions, 5-6</strong><br>
<strong>requests library, 35, 36</strong> </p>
<h3 id="s">S</h3>

Loading…
Cancel
Save