Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e242659

Browse files
committed
Context manager, Operator, NumPy
1 parent f5c2495 commit e242659

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ class Counter:
11991199
```
12001200

12011201
### Context Manager
1202-
* **With statements only work with objects that have enter() and exit() special methods.**
1202+
* **With statements only work on objects that have enter() and exit() special methods.**
12031203
* **Enter() should lock the resources and optionally return an object.**
12041204
* **Exit() should release the resources.**
12051205
* **Any exception that happens inside the with block is passed to the exit() method.**
@@ -2160,7 +2160,7 @@ Operator
21602160
```python
21612161
import operator as op
21622162
<bool> = op.not_(<obj>) # or, and, not (or/and missing)
2163-
<bool> = op.eq/ne/lt/le/gt/ge/contains/is_(<obj>, <obj>) # ==, !=, <, <=, >, >=, in, is
2163+
<bool> = op.eq/ne/lt/le/gt/ge/is_/contains(<obj>, <obj>) # ==, !=, <, <=, >, >=, is, in
21642164
<obj> = op.or_/xor/and_(<int/set>, <int/set>) # |, ^, &
21652165
<int> = op.lshift/rshift(<int>, <int>) # <<, >>
21662166
<obj> = op.add/sub/mul/truediv/floordiv/mod(<obj>, <obj>) # +, -, *, /, //, %
@@ -2666,7 +2666,7 @@ import numpy as np
26662666

26672667
```python
26682668
<array> = np.copy/abs/sqrt/log/int64(<array>) # Returns new array of the same shape.
2669-
<array> = <array>.sum/max/mean/argmax/all(axis) # Passed dimension gets aggregated.
2669+
<array> = <array>.sum/max/mean/argmax/all(axis) # Aggregates specified dimension.
26702670
<array> = np.apply_along_axis(<func>, axis, <array>) # Func can return a scalar or array.
26712671
```
26722672

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@
10171017
(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>)
10181018
</code></pre>
10191019
<div><h3 id="contextmanager">Context Manager</h3><ul>
1020-
<li><strong>With statements only work with objects that have enter() and exit() special methods.</strong></li>
1020+
<li><strong>With statements only work on objects that have enter() and exit() special methods.</strong></li>
10211021
<li><strong>Enter() should lock the resources and optionally return an object.</strong></li>
10221022
<li><strong>Exit() should release the resources.</strong></li>
10231023
<li><strong>Any exception that happens inside the with block is passed to the exit() method.</strong></li>
@@ -1781,7 +1781,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
17811781
</ul>
17821782
<div><h2 id="operator"><a href="#operator" name="operator">#</a>Operator</h2><p><strong>Module of functions that provide the functionality of operators. Functions are ordered by operator precedence, starting with least binding.</strong></p><pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> operator <span class="hljs-keyword">as</span> op
17831783
&lt;bool&gt; = op.not_(&lt;obj&gt;) <span class="hljs-comment"># or, and, not (or/and missing)</span>
1784-
&lt;bool&gt; = op.eq/ne/lt/le/gt/ge/contains/is_(&lt;obj&gt;, &lt;obj&gt;) <span class="hljs-comment"># ==, !=, &lt;, &lt;=, &gt;, &gt;=, in, is</span>
1784+
&lt;bool&gt; = op.eq/ne/lt/le/gt/ge/is_/contains(&lt;obj&gt;, &lt;obj&gt;) <span class="hljs-comment"># ==, !=, &lt;, &lt;=, &gt;, &gt;=, is, in</span>
17851785
&lt;obj&gt; = op.or_/xor/and_(&lt;int/set&gt;, &lt;int/set&gt;) <span class="hljs-comment"># |, ^, &amp;</span>
17861786
&lt;int&gt; = op.lshift/rshift(&lt;int&gt;, &lt;int&gt;) <span class="hljs-comment"># &lt;&lt;, &gt;&gt;</span>
17871787
&lt;obj&gt; = op.add/sub/mul/truediv/floordiv/mod(&lt;obj&gt;, &lt;obj&gt;) <span class="hljs-comment"># +, -, *, /, //, %</span>
@@ -2190,7 +2190,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
21902190
&lt;view&gt; = &lt;array&gt;.transpose() <span class="hljs-comment"># Or: &lt;array&gt;.T</span>
21912191
</code></pre>
21922192
<pre><code class="python language-python hljs">&lt;array&gt; = np.copy/abs/sqrt/log/int64(&lt;array&gt;) <span class="hljs-comment"># Returns new array of the same shape.</span>
2193-
&lt;array&gt; = &lt;array&gt;.sum/max/mean/argmax/all(axis) <span class="hljs-comment"># Passed dimension gets aggregated.</span>
2193+
&lt;array&gt; = &lt;array&gt;.sum/max/mean/argmax/all(axis) <span class="hljs-comment"># Aggregates specified dimension.</span>
21942194
&lt;array&gt; = np.apply_along_axis(&lt;func&gt;, axis, &lt;array&gt;) <span class="hljs-comment"># Func can return a scalar or array.</span>
21952195
</code></pre>
21962196
<pre><code class="python language-python hljs">&lt;array&gt; = np.concatenate(&lt;list_of_arrays&gt;, axis=<span class="hljs-number">0</span>) <span class="hljs-comment"># Links arrays along first axis (rows).</span>

0 commit comments

Comments
 (0)