Skip to content

Commit 4b76f8a

Browse files
committed
Some formatting & grammar fixes for the multiprocessing doc
1 parent c016f46 commit 4b76f8a

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

Doc/library/multiprocessing.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ For example::
282282

283283
if __name__ == '__main__':
284284
pool = Pool(processes=4) # start 4 worker processes
285-
result = pool.apply_async(f, [10]) # evaluate "f(10)" asynchronously
285+
result = pool.apply_async(f, [10]) # evaluate "f(10)" asynchronously
286286
print result.get(timeout=1) # prints "100" unless your computer is *very* slow
287287
print pool.map(f, range(10)) # prints "[0, 1, 4,..., 81]"
288288

@@ -472,7 +472,7 @@ into Python 2.5's :class:`Queue.Queue` class.
472472

473473
If you use :class:`JoinableQueue` then you **must** call
474474
:meth:`JoinableQueue.task_done` for each task removed from the queue or else the
475-
semaphore used to count the number of unfinished tasks may eventually overflow
475+
semaphore used to count the number of unfinished tasks may eventually overflow,
476476
raising an exception.
477477

478478
Note that one can also create a shared queue by using a manager object -- see
@@ -490,7 +490,7 @@ Note that one can also create a shared queue by using a manager object -- see
490490

491491
If a process is killed using :meth:`Process.terminate` or :func:`os.kill`
492492
while it is trying to use a :class:`Queue`, then the data in the queue is
493-
likely to become corrupted. This may cause any other processes to get an
493+
likely to become corrupted. This may cause any other process to get an
494494
exception when it tries to use the queue later on.
495495

496496
.. warning::
@@ -692,7 +692,7 @@ Miscellaneous
692692
(By default :data:`sys.executable` is used). Embedders will probably need to
693693
do some thing like ::
694694

695-
setExecutable(os.path.join(sys.exec_prefix, 'pythonw.exe'))
695+
set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))
696696

697697
before they can create child processes. (Windows only)
698698

@@ -711,7 +711,7 @@ Connection Objects
711711
Connection objects allow the sending and receiving of picklable objects or
712712
strings. They can be thought of as message oriented connected sockets.
713713

714-
Connection objects usually created using :func:`Pipe` -- see also
714+
Connection objects are usually created using :func:`Pipe` -- see also
715715
:ref:`multiprocessing-listeners-clients`.
716716

717717
.. class:: Connection
@@ -722,7 +722,7 @@ Connection objects usually created using :func:`Pipe` -- see also
722722
using :meth:`recv`.
723723

724724
The object must be picklable. Very large pickles (approximately 32 MB+,
725-
though it depends on the OS) may raise a ValueError exception.
725+
though it depends on the OS) may raise a :exc:`ValueError` exception.
726726

727727
.. method:: recv()
728728

@@ -732,7 +732,7 @@ Connection objects usually created using :func:`Pipe` -- see also
732732

733733
.. method:: fileno()
734734

735-
Returns the file descriptor or handle used by the connection.
735+
Return the file descriptor or handle used by the connection.
736736

737737
.. method:: close()
738738

@@ -756,7 +756,7 @@ Connection objects usually created using :func:`Pipe` -- see also
756756
If *offset* is given then data is read from that position in *buffer*. If
757757
*size* is given then that many bytes will be read from buffer. Very large
758758
buffers (approximately 32 MB+, though it depends on the OS) may raise a
759-
ValueError exception
759+
:exc:`ValueError` exception
760760

761761
.. method:: recv_bytes([maxlength])
762762

@@ -1329,7 +1329,7 @@ Customized managers
13291329
>>>>>>>>>>>>>>>>>>>
13301330

13311331
To create one's own manager, one creates a subclass of :class:`BaseManager` and
1332-
use the :meth:`~BaseManager.register` classmethod to register new types or
1332+
uses the :meth:`~BaseManager.register` classmethod to register new types or
13331333
callables with the manager class. For example::
13341334

13351335
from multiprocessing.managers import BaseManager
@@ -1579,10 +1579,10 @@ with the :class:`Pool` class.
15791579

15801580
.. method:: apply(func[, args[, kwds]])
15811581

1582-
Equivalent of the :func:`apply` built-in function. It blocks till the
1583-
result is ready. Given this blocks, :meth:`apply_async` is better suited
1584-
for performing work in parallel. Additionally, the passed
1585-
in function is only executed in one of the workers of the pool.
1582+
Equivalent of the :func:`apply` built-in function. It blocks until the
1583+
result is ready, so :meth:`apply_async` is better suited for performing
1584+
work in parallel. Additionally, *func* is only executed in one of the
1585+
workers of the pool.
15861586

15871587
.. method:: apply_async(func[, args[, kwds[, callback]]])
15881588

@@ -1596,7 +1596,7 @@ with the :class:`Pool` class.
15961596
.. method:: map(func, iterable[, chunksize])
15971597

15981598
A parallel equivalent of the :func:`map` built-in function (it supports only
1599-
one *iterable* argument though). It blocks till the result is ready.
1599+
one *iterable* argument though). It blocks until the result is ready.
16001600

16011601
This method chops the iterable into a number of chunks which it submits to
16021602
the process pool as separate tasks. The (approximate) size of these
@@ -2046,7 +2046,7 @@ Better to inherit than pickle/unpickle
20462046
On Windows many types from :mod:`multiprocessing` need to be picklable so
20472047
that child processes can use them. However, one should generally avoid
20482048
sending shared objects to other processes using pipes or queues. Instead
2049-
you should arrange the program so that a process which need access to a
2049+
you should arrange the program so that a process which needs access to a
20502050
shared resource created elsewhere can inherit it from an ancestor process.
20512051

20522052
Avoid terminating processes
@@ -2125,7 +2125,7 @@ Explicitly pass resources to child processes
21252125
for i in range(10):
21262126
Process(target=f, args=(lock,)).start()
21272127

2128-
Beware replacing sys.stdin with a "file like object"
2128+
Beware of replacing :data:`sys.stdin` with a "file like object"
21292129

21302130
:mod:`multiprocessing` originally unconditionally called::
21312131

@@ -2243,7 +2243,7 @@ Synchronization types like locks, conditions and queues:
22432243

22442244

22452245
An example showing how to use queues to feed tasks to a collection of worker
2246-
process and collect the results:
2246+
processes and collect the results:
22472247

22482248
.. literalinclude:: ../includes/mp_workers.py
22492249

0 commit comments

Comments
 (0)