|
55 | 55 |
|
56 | 56 | <body> |
57 | 57 | <header> |
58 | | - <aside>November 29, 2024</aside> |
| 58 | + <aside>December 1, 2024</aside> |
59 | 59 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
60 | 60 | </header> |
61 | 61 |
|
@@ -1868,7 +1868,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
1868 | 1868 |
|
1869 | 1869 | <div><h3 id="semaphoreeventbarrier">Semaphore, Event, Barrier</h3><pre><code class="python language-python hljs"><Semaphore> = Semaphore(value=<span class="hljs-number">1</span>) <span class="hljs-comment"># Lock that can be acquired by 'value' threads.</span> |
1870 | 1870 | <Event> = Event() <span class="hljs-comment"># Method wait() blocks until set() is called.</span> |
1871 | | -<Barrier> = Barrier(n_times) <span class="hljs-comment"># Wait() blocks until it's called n_times.</span> |
| 1871 | +<Barrier> = Barrier(n_times) <span class="hljs-comment"># Wait() blocks until it's called n times.</span> |
1872 | 1872 | </code></pre></div> |
1873 | 1873 |
|
1874 | 1874 | <div><h3 id="queue">Queue</h3><pre><code class="python language-python hljs"><Queue> = queue.Queue(maxsize=<span class="hljs-number">0</span>) <span class="hljs-comment"># A thread-safe first-in-first-out queue.</span> |
@@ -2211,7 +2211,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2211 | 2211 | </code></pre> |
2212 | 2212 | <ul> |
2213 | 2213 | <li><strong><code class="python hljs"><span class="hljs-string">':'</span></code> returns a slice of all dimension's indices. Omitted dimensions default to <code class="python hljs"><span class="hljs-string">':'</span></code>.</strong></li> |
2214 | | -<li><strong>Indices should not be tuples because Python converts <code class="python hljs"><span class="hljs-string">'obj[i, j]'</span></code> to <code class="python hljs"><span class="hljs-string">'obj[(i, j)]'</span></code>!</strong></li> |
| 2214 | +<li><strong>Sixth line fails if tuple is used because Python converts <code class="python hljs"><span class="hljs-string">'obj[i, j]'</span></code> to <code class="python hljs"><span class="hljs-string">'obj[(i, j)]'</span></code>!</strong></li> |
2215 | 2215 | <li><strong>Indexing with a slice and 1d array works the same as when using two slices (lines 4, 6, 7).</strong></li> |
2216 | 2216 | <li><strong><code class="python hljs"><span class="hljs-string">'ix_([1, 2], [3, 4])'</span></code> returns <code class="python hljs"><span class="hljs-string">'[[1], [2]]'</span></code> and <code class="python hljs"><span class="hljs-string">'[[3, 4]]'</span></code>. Due to broadcasting rules, this is the same as using <code class="python hljs"><span class="hljs-string">'[[1, 1], [2, 2]]'</span></code> and <code class="python hljs"><span class="hljs-string">'[[3, 4], [3, 4]]'</span></code>.</strong></li> |
2217 | 2217 | <li><strong>Any value that is broadcastable to the indexed shape can be assigned to the selection.</strong></li> |
@@ -2451,7 +2451,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2451 | 2451 | pg.display.flip() |
2452 | 2452 | </code></pre></div> |
2453 | 2453 |
|
2454 | | -<div><h3 id="rectangle">Rectangle</h3><p><strong>Object for storing rectangular coordinates.</strong></p><pre><code class="python language-python hljs"><Rect> = pg.Rect(x, y, width, height) <span class="hljs-comment"># Floats get truncated into ints.</span> |
| 2454 | +<div><h3 id="rectangle">Rectangle</h3><p><strong>Object for storing rectangular coordinates.</strong></p><pre><code class="python language-python hljs"><Rect> = pg.Rect(x, y, width, height) <span class="hljs-comment"># Returns a rectangle. Floats get truncated.</span> |
2455 | 2455 | <int> = <Rect>.x/y/centerx/centery/… <span class="hljs-comment"># Top, right, bottom, left. Allows assignments.</span> |
2456 | 2456 | <tup.> = <Rect>.topleft/center/… <span class="hljs-comment"># Topright, bottomright, bottomleft. Same.</span> |
2457 | 2457 | <Rect> = <Rect>.move((delta_x, delta_y)) <span class="hljs-comment"># Use move_ip() to move in-place.</span> |
@@ -2924,7 +2924,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2924 | 2924 |
|
2925 | 2925 |
|
2926 | 2926 | <footer> |
2927 | | - <aside>November 29, 2024</aside> |
| 2927 | + <aside>December 1, 2024</aside> |
2928 | 2928 | <a href="https://gto76.github.io" rel="author">Jure Šorn</a> |
2929 | 2929 | </footer> |
2930 | 2930 |
|
|
0 commit comments