summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-11-22 08:51:39 (GMT)
committerGeorg Brandl <georg@python.org>2008-11-22 08:51:39 (GMT)
commit9290503b2af7eed9667aefefd823e058385dc91d (patch)
tree198b41cfd132c0a7ae438d995d22f8519918fa16
parent59d64f7830b7f45abec58e472c1e64523c02f66c (diff)
downloadcpython-9290503b2af7eed9667aefefd823e058385dc91d.zip
cpython-9290503b2af7eed9667aefefd823e058385dc91d.tar.gz
cpython-9290503b2af7eed9667aefefd823e058385dc91d.tar.bz2
#4206: fix 2.xisms in multiprocessing docs and docstrings.
-rw-r--r--Doc/library/multiprocessing.rst6
-rw-r--r--Lib/multiprocessing/pool.py15
2 files changed, 11 insertions, 10 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
index 5cfd42e..e15ff4d 100644
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -1447,8 +1447,8 @@ with the :class:`Pool` class.
.. method:: map(func, iterable[, chunksize])
- A parallel equivalent of the :func:`map` builtin function. It blocks till
- the result is ready.
+ A parallel equivalent of the :func:`map` builtin function, collecting the
+ result in a list. It blocks till the whole result is ready.
This method chops the iterable into a number of chunks which it submits to
the process pool as separate tasks. The (approximate) size of these
@@ -1465,7 +1465,7 @@ with the :class:`Pool` class.
.. method:: imap(func, iterable[, chunksize])
- An lazier version of :meth:`map`.
+ A lazier version of :meth:`map`.
The *chunksize* argument is the same as the one used by the :meth:`.map`
method. For very long iterables using a large value for *chunksize* can
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index 90fd178..bf2608d 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -76,7 +76,7 @@ def worker(inqueue, outqueue, initializer=None, initargs=()):
class Pool(object):
'''
- Class which supports an async version of the `apply()` builtin
+ Class which supports an async version of applying functions to arguments.
'''
Process = Process
@@ -135,21 +135,22 @@ class Pool(object):
def apply(self, func, args=(), kwds={}):
'''
- Equivalent of `apply()` builtin
+ Equivalent of `func(*args, **kwds)`.
'''
assert self._state == RUN
return self.apply_async(func, args, kwds).get()
def map(self, func, iterable, chunksize=None):
'''
- Equivalent of `map()` builtin
+ Apply `func` to each element in `iterable`, collecting the results
+ in a list that is returned.
'''
assert self._state == RUN
return self.map_async(func, iterable, chunksize).get()
def imap(self, func, iterable, chunksize=1):
'''
- Equivalent of `itertool.imap()` -- can be MUCH slower than `Pool.map()`
+ Equivalent of `map()` -- can be MUCH slower than `Pool.map()`.
'''
assert self._state == RUN
if chunksize == 1:
@@ -167,7 +168,7 @@ class Pool(object):
def imap_unordered(self, func, iterable, chunksize=1):
'''
- Like `imap()` method but ordering of results is arbitrary
+ Like `imap()` method but ordering of results is arbitrary.
'''
assert self._state == RUN
if chunksize == 1:
@@ -185,7 +186,7 @@ class Pool(object):
def apply_async(self, func, args=(), kwds={}, callback=None):
'''
- Asynchronous equivalent of `apply()` builtin
+ Asynchronous version of `apply()` method.
'''
assert self._state == RUN
result = ApplyResult(self._cache, callback)
@@ -194,7 +195,7 @@ class Pool(object):
def map_async(self, func, iterable, chunksize=None, callback=None):
'''
- Asynchronous equivalent of `map()` builtin
+ Asynchronous version of `map()` method.
'''
assert self._state == RUN
if not hasattr(iterable, '__len__'):