PyDocs

Nav

Concurrent Execution

Pool.map

  • Pool.map(func, iterable[, chunksize])
Apply `func` to each element in `iterable`, collecting the results
in a list that is returned.
1 Example
>>> from multiprocessing import Pool
>>> p = Pool(5)
>>> def f(x):
...     return x*x
...
>>> with p:
...     p.map(f, [1,2,3])
Process PoolWorker-1:
Process PoolWorker-2:
Process PoolWorker-3:
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)>
AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)>
AttributeError: Can't get attribute 'f' on <module '__main__' (<class '_frozen_importlib.BuiltinImporter'>)>
from the Python docs
See Also
No see-alsos for multiprocessing.pool/Pool.map
0 Notes
No notes for Pool.map