title: How do I replace a nested loop with concurrent.futures?
body: <p>Say, I have the following loops:</p>
  
  <pre class="lang-py prettyprint-override"><code>for i in range(50):
     for j in range(50):
        for k in range(50):
           for l in range(50):
               some_function(i,j,k,l)
  </code></pre>
  
  <p><code>some_function</code> happens to be a web scraper for a lot of small files, so it makes sense to parallelize this.</p>
  
  <p>But as far as I can tell, concurrent.futures only accepts one iterator, so I'm not sure how to approach this. What I <em>could</em> do is express (two of) them as a single iterator like:</p>
  
  <pre class="lang-py prettyprint-override"><code>def in_between_function(a):
      x = math.floor(a/5)
      y = a % y
      some_function(x,y)
  
  with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
     future = executor.map(in_between_function, range(50*50))
  </code></pre>
  
  <p>That doesn't look too bad but I want to do it properly; if I extend this to more iterators, negative numbers or if the iterator is not linear then this will be a nightmare to maintain.</p>