<div dir="ltr">I am proposing an extension to the multiprocessing.Pool API that allows for an alternative way to pass data to Pool worker processes, <b>without</b> using globals.<div><br></div><div><div>A <a href="https://github.com/python/cpython/pull/9627">PR has been opened</a>, extensive test coverage is also included, with all tests & CI passing on github.</div><div><br></div><div>Please <a href="https://thelaziestprogrammer.com/python/multiprocessing-pool-expect-initret-proposal">see this blog post</a> for details, motivation, and use cases of the API extension before reading on.</div><div><br></div><div>In <b>short</b>, the implementation of the feature works as follows:</div><div><ol><li>Exposes a kwarg on Pool.__init__ called `expect_initret`, that defaults to False. When set to True:</li><ol><li>Capture the return value of the initializer kwarg of Pool</li><li>Pass this value to the function being applied, as a kwarg.</li></ol></ol>Again, in <b>short,</b> the motivation of the feature is to provide an explicit "flow of data" from parent process to worker process, and to avoid being <u>forced</u> to using the <b>global</b> keyword in initializer, or being <u>forced</u> to create global variables in the parent process.</div><div><br>The interface is 100% backwards compatible through Python3.x (and perhaps beyond).<br><div><br></div><div><br></div></div></div></div>