title: Python multithreaded print statements delayed until all threads complete execution
body: <p>I have a piece of code below that creates a few threads to perform a task, which works perfectly well on its own. However I'm struggling to understand why the print statements I call in my function do not execute until all threads complete and the <code>print 'finished'</code> statement is called. I would expect them to be called as the thread executes. Is there any simple way to accomplish this, and why does this work this way in the first place?</p>
  
  <pre><code>def func(param):
      time.sleep(.25)
      print param*2
  
  if __name__ == '__main__':
      print 'starting execution'
      launchTime = time.clock()
      params = range(10)
      pool=multiprocessing.Pool(processes=100) #use N processes to download the data
      _=pool.map(func,params)
      print 'finished'
  </code></pre>