title: ThreadPoolExecutor: how to limit the queue maxsize?
body: <p>I am using ThreadPoolExecutor class from the concurrent.futures package</p>
  
  <pre><code>def some_func(arg):
      # does some heavy lifting
      # outputs some results
  
  from concurrent.futures import ThreadPoolExecutor
  
  with ThreadPoolExecutor(max_workers=1) as executor:
      for arg in range(10000000):
          future = executor.submit(some_func, arg)
  </code></pre>
  
  <p>but I need to limit the queue size somehow, as I don't want millions of futures to be created at once, is there a simple way to do it or should I stick to queue.Queue and threading package to accomplish this?</p>