Issue 34837: Multiprocessing.pool API Extension - Pass Data to Workers w/o Globals (original) (raw)
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.