@@ -125,7 +125,7 @@ argument list. It is called as ::
125125
126126 handler(signum, frame)
127127
128- so it should be declared with two arguments ::
128+ so it should be declared with two parameters ::
129129
130130 def handler(signum, frame):
131131 ...
@@ -159,9 +159,9 @@ The "global main logic" of your program may be as simple as ::
159159
160160at the bottom of the main module of your program.
161161
162- Once your program is organized as a tractable collection of functions and class
163- behaviours you should write test functions that exercise the behaviours. A test
164- suite that automates a sequence of tests can be associated with each module.
162+ Once your program is organized as a tractable collection of function and class
163+ behaviours, you should write test functions that exercise the behaviours. A
164+ test suite that automates a sequence of tests can be associated with each module.
165165This sounds like a lot of work, but since Python is so terse and flexible it's
166166surprisingly easy. You can make coding much more pleasant and fun by writing
167167your test functions in parallel with the " production code" , since this makes it
@@ -295,7 +295,7 @@ queue as there are threads.
295295How do I parcel out work among a bunch of worker threads?
296296---------------------------------------------------------
297297
298- The easiest way is to use the new :mod:` concurrent.futures` module,
298+ The easiest way is to use the :mod:` concurrent.futures` module,
299299especially the :mod:` ~concurrent.futures.ThreadPoolExecutor` class.
300300
301301Or, if you want fine control over the dispatching algorithm, you can write
@@ -679,7 +679,7 @@ How can I mimic CGI form submission (METHOD=POST)?
679679I would like to retrieve web pages that are the result of POSTing a form. Is
680680there existing code that would let me do this easily?
681681
682- Yes. Here's a simple example that uses urllib.request::
682+ Yes. Here's a simple example that uses :mod: ` urllib.request` ::
683683
684684 #!/usr/local/bin/python
685685
@@ -765,20 +765,21 @@ The :mod:`select` module is commonly used to help with asynchronous I/O on
765765sockets.
766766
767767To prevent the TCP connect from blocking, you can set the socket to non-blocking
768- mode. Then when you do the ` ` connect() ` ` , you will either connect immediately
768+ mode. Then when you do the :meth: ` socket. connect` , you will either connect immediately
769769(unlikely) or get an exception that contains the error number as ` ` .errno` ` .
770770` ` errno.EINPROGRESS` ` indicates that the connection is in progress, but hasn't
771771finished yet. Different OSes will return different values, so you're going to
772772have to check what's returned on your system.
773773
774- You can use the ` ` connect_ex() ` ` method to avoid creating an exception. It will
775- just return the errno value. To poll, you can call ` ` connect_ex() ` ` again later
774+ You can use the :meth: ` socket. connect_ex` method to avoid creating an exception. It will
775+ just return the errno value. To poll, you can call :meth: ` socket. connect_ex` again later
776776-- ` ` 0` ` or ` ` errno.EISCONN` ` indicate that you're connected -- or you can pass this
777- socket to select to check if it's writable.
777+ socket to :meth: ` select.select ` to check if it's writable.
778778
779779.. note::
780- The :mod:` asyncore` module presents a framework-like approach to the problem
781- of writing non-blocking networking code.
780+ The :mod:` asyncio` module provides a general purpose single-threaded and
781+ concurrent asynchronous library, which can be used for writing non-blocking
782+ network code.
782783 The third-party ` Twisted < https://twistedmatrix.com/trac/> ` _ library is
783784 a popular and feature-rich alternative.
784785
@@ -832,8 +833,8 @@ There are also many other specialized generators in this module, such as:
832833
833834Some higher-level functions operate on sequences directly, such as:
834835
835- * ` ` choice(S)` ` chooses random element from a given sequence
836- * ` ` shuffle(L)` ` shuffles a list in-place, i.e. permutes it randomly
836+ * ` ` choice(S)` ` chooses a random element from a given sequence.
837+ * ` ` shuffle(L)` ` shuffles a list in-place, i.e. permutes it randomly.
837838
838839There's also a ` ` Random` ` class you can instantiate to create independent
839840multiple random number generators.
0 commit comments