title: python multiprocessing queue implementation
body: <p>I'm having trouble understanding how to implement queue into a multiprocessing example below.  Basically, I want the code to:</p>
  
  <p>1) spawn 2 processes (done)</p>
  
  <p>2) split up my id_list into two portions (done)</p>
  
  <p>3) have each process iterate over the list printing out each item, and only close when its done with the list.  I know I have to implement some type of Queueing system, and pass that to each worker, but I'm not sure how to do that.  Any help would be much appreciated.</p>
  
  <pre><code>from multiprocessing import Pool,Queue
  id_list = [1,2,3,4,5,6,7,8,9,10]
  
  def mp_worker(record):
      try:  
          print record
          sleep(1)
      except: pass
      print "worker closed"
  
  def mp_handler():
      p = Pool(processes = 2) #number of processes
      p.map(mp_worker, id_list)  #devides id_list between 2 processes, defined above
      p.close()
      p.join()
  
  mp_handler()
  </code></pre>
  
  <p>Note - the code prints out "worker closed" 10 times.  Id like for this statement to be printed only twice (once for each worker, after each worker prints out the 5 numbers from id_list)</p>