diff --git a/README.md b/README.md index fdc29b9..8c30272 100644 --- a/README.md +++ b/README.md @@ -2218,7 +2218,7 @@ Introspection ------------- ```python = dir() # Local names of variables, functions, classes and modules. - = vars() # Dict of local names and their objects. Also locals(). + = vars() # Dict of local names and their objects. Same as locals(). = globals() # Dict of global names and their objects, e.g. __builtin__. ``` @@ -2260,20 +2260,20 @@ from concurrent.futures import ThreadPoolExecutor, as_completed ```python = Lock/RLock() # RLock can only be released by acquirer thread. .acquire() # Blocks (waits) until lock becomes available. -.release() # It makes the acquired lock available again. +.release() # Releases the lock so it can be acquired again. ``` #### Or: ```python with : # Enters the block by calling method acquire(). - ... # Exits by calling release(), even on error. + ... # Exits it by calling release(), even on error. ``` ### Semaphore, Event, Barrier ```python = Semaphore(value=1) # Lock that can be acquired by 'value' threads. = Event() # Method wait() blocks until set() is called. - = Barrier(n_times) # Wait() blocks until it's called n times. + = Barrier() # Wait() blocks until it's called int times. ``` ### Queue @@ -2307,7 +2307,7 @@ with : # Enters the block by calling met Coroutines ---------- * **Coroutines have a lot in common with threads, but unlike threads, they only give up control when they call another coroutine and they don’t consume as much memory.** -* **Coroutine definition starts with `'async'` and its call with `'await'` keyword.** +* **Coroutine definition starts with `'async'` keyword and its call with `'await'`.** * **Use `'asyncio.run()'` to start the first/main coroutine.** ```python @@ -2333,7 +2333,7 @@ import asyncio, collections, curses, curses.textpad, enum, random P = collections.namedtuple('P', 'x y') # Position (x and y coordinates). D = enum.Enum('D', 'n e s w') # Direction (north, east, etc.). -W, H = 15, 7 # Width and height constants. +W, H = 15, 7 # Width and height of the field. def main(screen): curses.curs_set(0) # Makes the cursor invisible. diff --git a/index.html b/index.html index c8a209f..8d9c6d3 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@
- +
@@ -1833,7 +1833,7 @@ CRITICAL:my_module:Running out of disk space.

#Introspection

<list> = dir()                      # Local names of variables, functions, classes and modules.
-<dict> = vars()                     # Dict of local names and their objects. Also locals().
+<dict> = vars()                     # Dict of local names and their objects. Same as locals().
 <dict> = globals()                  # Dict of global names and their objects, e.g. __builtin__.
 
@@ -1865,16 +1865,16 @@ delattr(<obj>, '<name>')

Lock

<lock> = Lock/RLock()                          # RLock can only be released by acquirer thread.
 <lock>.acquire()                               # Blocks (waits) until lock becomes available.
-<lock>.release()                               # It makes the acquired lock available again.
+<lock>.release()                               # Releases the lock so it can be acquired again.
 

Or:

with <lock>:                                   # Enters the block by calling method acquire().
-    ...                                        # Exits by calling release(), even on error.
+    ...                                        # Exits it by calling release(), even on error.
 

Semaphore, Event, Barrier

<Semaphore> = Semaphore(value=1)               # Lock that can be acquired by 'value' threads.
 <Event>     = Event()                          # Method wait() blocks until set() is called.
-<Barrier>   = Barrier(n_times)                 # Wait() blocks until it's called n times.
+<Barrier>   = Barrier(<int>)                   # Wait() blocks until it's called int times.
 

Queue

<Queue> = queue.Queue(maxsize=0)               # A first-in-first-out queue. It's thread safe.
@@ -1902,7 +1902,7 @@ delattr(<obj>, '<name>')
 
 

#Coroutines

  • Coroutines have a lot in common with threads, but unlike threads, they only give up control when they call another coroutine and they don’t consume as much memory.
  • -
  • Coroutine definition starts with 'async' and its call with 'await' keyword.
  • +
  • Coroutine definition starts with 'async' keyword and its call with 'await'.
  • Use 'asyncio.run(<coroutine>)' to start the first/main coroutine.
import asyncio as aio
 
@@ -1921,7 +1921,7 @@ delattr(<obj>, '<name>') P = collections.namedtuple('P', 'x y') # Position (x and y coordinates). D = enum.Enum('D', 'n e s w') # Direction (north, east, etc.). -W, H = 15, 7 # Width and height constants. +W, H = 15, 7 # Width and height of the field. def main(screen): curses.curs_set(0) # Makes the cursor invisible. @@ -2934,7 +2934,7 @@ $ deactivate # Deactivates the active
- +
diff --git a/parse.js b/parse.js index 7990696..36cb888 100755 --- a/parse.js +++ b/parse.js @@ -122,7 +122,7 @@ const COROUTINES = '\n' + 'P = collections.namedtuple(\'P\', \'x y\') # Position (x and y coordinates).\n' + 'D = enum.Enum(\'D\', \'n e s w\') # Direction (north, east, etc.).\n' + - 'W, H = 15, 7 # Width and height constants.\n' + + 'W, H = 15, 7 # Width and height of the field.\n' + '\n' + 'def main(screen):\n' + ' curses.curs_set(0) # Makes the cursor invisible.\n' +