title: Apply reduce on generator output with multiprocessing
body: <p>I have a generator function (Python) that works like this</p>
  
  <pre><code>def Mygenerator(x, y, z, ...):
      while True:
          # code that makes two matrices based on sequences of input arrays
          yield (matrix1, matrix2)
  </code></pre>
  
  <p>What I want to do is to add the output from this generator. This line does the job:</p>
  
  <pre><code>M1, M2 = reduce(lambda x, y: x[0] + y[0], x[1] + y[1], Mygenerator(x, y, z, ...))
  </code></pre>
  
  <p>I would like to parallelize this to speed up the computations. It is important that the outputs from Mygenerator is reduced as it is yielded, since <code>list(Mygenerator(...))</code> would take too much memory.</p>