[issue34837] Multiprocessing.pool API Extension - Pass Data to Workers w/o Globals

Terry J. Reedy report at bugs.python.org
Fri Oct 5 14:45:08 EDT 2018


New submission from Terry J. Reedy <tjreedy at udel.edu>:

Quoting the PR:

Proposing a new kwarg in the __init__() method of multiprocessing.Pool named expect_initret.

This kwarg defaults to False. When set to True, the return value of the initializer function is passed to the function we are applying (i.e. func in Pool.map(func, ls)), as a kwarg named initret.

This PR includes thorough test coverage, and provides backwards compatibility (at least in Python3.x).

See blog post
https://thelaziestprogrammer.com/python/multiprocessing-pool-expect-initret-proposal
for example use cases, as well as an initial defense for why this makes the multiprocessing.Pool API more approachable, to more Python end-users, and augments the library.

----------
nosy: +davin, pitrou, terry.reedy

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34837>
_______________________________________


More information about the Python-bugs-list mailing list