title: Exception handling in concurrent.futures.Executor.map
body: <p>From <a href="https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map" rel="noreferrer">https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor.map</a></p>
  
  <blockquote>
    <p>If a func call raises an exception, then that exception will be raised
    when its value is retrieved from the iterator.</p>
  </blockquote>
  
  <p>The following snippet only outptus the first exeption (Exeption: 1), and stops. Does this contradict the above statement? I expect the following to print out all exceptions in the loop.</p>
  
  <pre><code>def test_func(val):
    raise Exception(val)        
  
  with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:   
    for r in executor.map(test_func,[1,2,3,4,5]):
      try:
        print r
      except Exception as exc:
        print 'generated an exception: %s' % (exc)
  </code></pre>