Skip to content

Commit c419967

Browse files
committed
Threading, NumPy, Pygame
1 parent 7daf56e commit c419967

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ with <lock>: # Enters the block by calling acq
22852285
```python
22862286
<Semaphore> = Semaphore(value=1) # Lock that can be acquired by 'value' threads.
22872287
<Event> = Event() # Method wait() blocks until set() is called.
2288-
<Barrier> = Barrier(n_times) # Wait() blocks until it's called n_times.
2288+
<Barrier> = Barrier(n_times) # Wait() blocks until it's called n times.
22892289
```
22902290

22912291
### Queue
@@ -2710,7 +2710,7 @@ import numpy as np
27102710
<1/2d_arr> = <2d>[<2d/1d_bools>] # 1d_bools must have size of a column.
27112711
```
27122712
* **`':'` returns a slice of all dimension's indices. Omitted dimensions default to `':'`.**
2713-
* **Indices should not be tuples because Python converts `'obj[i, j]'` to `'obj[(i, j)]'`!**
2713+
* **Sixth line fails if tuple is used because Python converts `'obj[i, j]'` to `'obj[(i, j)]'`!**
27142714
* **Indexing with a slice and 1d array works the same as when using two slices (lines 4, 6, 7).**
27152715
* **`'ix_([1, 2], [3, 4])'` returns `'[[1], [2]]'` and `'[[3, 4]]'`. Due to broadcasting rules, this is the same as using `'[[1, 1], [2, 2]]'` and `'[[3, 4], [3, 4]]'`.**
27162716
* **Any value that is broadcastable to the indexed shape can be assigned to the selection.**
@@ -3011,7 +3011,7 @@ while not pg.event.get(pg.QUIT):
30113011
### Rectangle
30123012
**Object for storing rectangular coordinates.**
30133013
```python
3014-
<Rect> = pg.Rect(x, y, width, height) # Floats get truncated into ints.
3014+
<Rect> = pg.Rect(x, y, width, height) # Returns a rectangle. Floats get truncated.
30153015
<int> = <Rect>.x/y/centerx/centery/# Top, right, bottom, left. Allows assignments.
30163016
<tup.> = <Rect>.topleft/center/# Topright, bottomright, bottomleft. Same.
30173017
<Rect> = <Rect>.move((delta_x, delta_y)) # Use move_ip() to move in-place.

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
<body>
5757
<header>
58-
<aside>November 29, 2024</aside>
58+
<aside>December 1, 2024</aside>
5959
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
6060
</header>
6161

@@ -1868,7 +1868,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
18681868

18691869
<div><h3 id="semaphoreeventbarrier">Semaphore, Event, Barrier</h3><pre><code class="python language-python hljs">&lt;Semaphore&gt; = Semaphore(value=<span class="hljs-number">1</span>) <span class="hljs-comment"># Lock that can be acquired by 'value' threads.</span>
18701870
&lt;Event&gt; = Event() <span class="hljs-comment"># Method wait() blocks until set() is called.</span>
1871-
&lt;Barrier&gt; = Barrier(n_times) <span class="hljs-comment"># Wait() blocks until it's called n_times.</span>
1871+
&lt;Barrier&gt; = Barrier(n_times) <span class="hljs-comment"># Wait() blocks until it's called n times.</span>
18721872
</code></pre></div>
18731873

18741874
<div><h3 id="queue">Queue</h3><pre><code class="python language-python hljs">&lt;Queue&gt; = 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
22112211
</code></pre>
22122212
<ul>
22132213
<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>
22152215
<li><strong>Indexing with a slice and 1d array works the same as when using two slices (lines 4, 6, 7).</strong></li>
22162216
<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>
22172217
<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
24512451
pg.display.flip()
24522452
</code></pre></div>
24532453

2454-
<div><h3 id="rectangle">Rectangle</h3><p><strong>Object for storing rectangular coordinates.</strong></p><pre><code class="python language-python hljs">&lt;Rect&gt; = 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">&lt;Rect&gt; = pg.Rect(x, y, width, height) <span class="hljs-comment"># Returns a rectangle. Floats get truncated.</span>
24552455
&lt;int&gt; = &lt;Rect&gt;.x/y/centerx/centery/… <span class="hljs-comment"># Top, right, bottom, left. Allows assignments.</span>
24562456
&lt;tup.&gt; = &lt;Rect&gt;.topleft/center/… <span class="hljs-comment"># Topright, bottomright, bottomleft. Same.</span>
24572457
&lt;Rect&gt; = &lt;Rect&gt;.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
29242924

29252925

29262926
<footer>
2927-
<aside>November 29, 2024</aside>
2927+
<aside>December 1, 2024</aside>
29282928
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
29292929
</footer>
29302930

0 commit comments

Comments
 (0)