|
|
@ -532,7 +532,7 @@ to_exclusive = <range>.stop |
|
|
|
<pre><code class="python language-python hljs"><num> = pow(<num>, <num>) <span class="hljs-comment"># Or: <num> ** <num></span> |
|
|
|
<real> = abs(<num>) |
|
|
|
<int> = round(<real>) |
|
|
|
<real> = round(<real>, ±ndigits) |
|
|
|
<real> = round(<real>, ±ndigits) <span class="hljs-comment"># `round(126, -1) == 130`</span> |
|
|
|
</code></pre> |
|
|
|
<h3 id="math">Math</h3> |
|
|
|
<pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> math <span class="hljs-keyword">import</span> e, pi, inf, nan |
|
|
@ -1412,8 +1412,7 @@ db.commit() |
|
|
|
</code></pre> |
|
|
|
<pre><code class="python language-python hljs"><deque>.appendleft(<el>) |
|
|
|
<el> = <deque>.popleft() |
|
|
|
</code></pre> |
|
|
|
<pre><code class="python language-python hljs"><deque>.extendleft(<collection>) <span class="hljs-comment"># Collection gets reversed.</span> |
|
|
|
<deque>.extendleft(<collection>) <span class="hljs-comment"># Collection gets reversed.</span> |
|
|
|
<deque>.rotate(n=<span class="hljs-number">1</span>) <span class="hljs-comment"># Rotates elements to the right.</span> |
|
|
|
</code></pre> |
|
|
|
<pre><code class="python language-python hljs"><span class="hljs-meta">>>> </span>a = deque([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], maxlen=<span class="hljs-number">3</span>) |
|
|
@ -1440,7 +1439,8 @@ lock.acquire() |
|
|
|
lock.release() |
|
|
|
</code></pre> |
|
|
|
<h4 id="or">Or:</h4> |
|
|
|
<pre><code class="python language-python hljs"><span class="hljs-keyword">with</span> lock: |
|
|
|
<pre><code class="python language-python hljs">lock = RLock() |
|
|
|
<span class="hljs-keyword">with</span> lock: |
|
|
|
... |
|
|
|
</code></pre> |
|
|
|
<h2 id="introspection"><a href="#introspection" name="introspection">#</a>Introspection</h2> |
|
|
|
xxxxxxxxxx