@@ -532,7 +532,7 @@ <h3 id="basicfunctions">Basic Functions</h3>
532
532
< pre > < code class ="python language-python hljs "> <num> = pow(<num>, <num>) < span class ="hljs-comment "> # Or: <num> ** <num></ span >
533
533
<real> = abs(<num>)
534
534
<int> = round(<real>)
535
- <real> = round(<real>, ±ndigits)
535
+ <real> = round(<real>, ±ndigits) < span class =" hljs-comment " > # `round(126, -1) == 130` </ span >
536
536
</ code > </ pre >
537
537
< h3 id ="math "> Math</ h3 >
538
538
< 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 @@ <h2 id="deque"><a href="#deque" name="deque">#</a>Deque</h2>
1412
1412
</ code > </ pre >
1413
1413
< pre > < code class ="python language-python hljs "> <deque>.appendleft(<el>)
1414
1414
<el> = <deque>.popleft()
1415
- </ code > </ pre >
1416
- < pre > < code class ="python language-python hljs "> <deque>.extendleft(<collection>) < span class ="hljs-comment "> # Collection gets reversed.</ span >
1415
+ <deque>.extendleft(<collection>) < span class ="hljs-comment "> # Collection gets reversed.</ span >
1417
1416
<deque>.rotate(n=< span class ="hljs-number "> 1</ span > ) < span class ="hljs-comment "> # Rotates elements to the right.</ span >
1418
1417
</ code > </ pre >
1419
1418
< 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 @@ <h3 id="lock">Lock</h3>
1440
1439
lock.release()
1441
1440
</ code > </ pre >
1442
1441
< h4 id ="or "> Or:</ h4 >
1443
- < pre > < code class ="python language-python hljs "> < span class ="hljs-keyword "> with</ span > lock:
1442
+ < pre > < code class ="python language-python hljs "> lock = RLock()
1443
+ < span class ="hljs-keyword "> with</ span > lock:
1444
1444
...
1445
1445
</ code > </ pre >
1446
1446
< h2 id ="introspection "> < a href ="#introspection " name ="introspection "> #</ a > Introspection</ h2 >
0 commit comments