title: Multiprocessing in a for loop
body: <p>I have the below <code>matching()</code> function with for loop to which I am passing a big <code>generator(unique_combinations)</code>. </p>
  
  <p>It takes days to process so I wanted to use multiprocessing for elements in the loop to speed things up but I just can't figure out how to do it. </p>
  
  <p>I find it difficult to understand the logic behind <code>concurrent.futures</code> in general.</p>
  
  <pre><code>    results = []
      match_score = []
  
      def matching():    
          for pair in unique_combinations:        
              if fuzz.ratio(pair[0], pair[1]) &gt; 90:    
                  results.append(pair)    
                  match_score.append(fuzz.ratio(pair[0], pair[1]))
  
      def main():    
          executor = ProcessPoolExecutor(max_workers=3)    
          task1 = executor.submit(matching)    
          task2 = executor.submit(matching)    
          task3 = executor.submit(matching)
  
      if __name__ == '__main__':
          main()
  
  print(results)
  print(match_score)
  </code></pre>
  
  <p>I am assuming this should speed up the execution.</p>