title: Trying to understand Python's Concurrent.Futures module
body: <p>I’m trying to understand how to use the <code>concurrent.futures</code> module in Python 3.2.2, and have been playing with examples from the documentation.  When I try to apply my understanding, my own examples fail.  I hope somebody can help me get on track!</p>
  
  <p>I want to be able to set a number of processes running concurrently but asynchronously.  My processes don't return anything.  To simulate this I have written a trivial example:</p>
  
  <pre><code>import concurrent.futures
  
  fred = [1,2,3,4,5,6,7,8,9,10]
  
  def f(x):
      print(x * x)
  
  def main():
      with concurrent.futures.ProcessPoolExecutor() as executor:
          for num in fred:
              executor.submit(f, num)
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>This code runs (on a 4 core Windows XP box) and returns:</p>
  
  <blockquote>
    <p>1  4  9  16  25</p>
  </blockquote>
  
  <p>...but then hangs.</p>
  
  <p>Clearly I’m doing something wrong.  So, what is the correct way to have Python run processes in a process pool?  I don’t want to use the <code>executor.map</code> approach, because I don’t have any return from my process.  </p>
  
  <p>Or…do I have to fake it, by having the process return <code>True</code> or <code>False</code> (or something)?</p>
  
  <p>Thanks!</p>