title: better way to get results from multiple threads
body: <p>what i want to do is be able to call a function with multiple threads and get their results. </p>
  
  <p>i have the following code: </p>
  
  <p>(it is an example, the actual code doesn't simply convert str to int)</p>
  
  <pre><code>from threading import Thread
  import time
  import Queue
  
  #an example - actual code connects to a server
  def str_to_int(arg, queue):
      result = 0
      result = int(arg)
      #sleep to check that they happen at once.
      time.sleep(10)
      queue.put(result)
  
  def combine():
      q1 = Queue.Queue()
      q2 = Queue.Queue()
      q3 = Queue.Queue()
  
      t1 = Thread(target = str_to_int, args=("111", q1))
      t2 = Thread(target = str_to_int, args=("222", q2))
      t3 = Thread(target = str_to_int, args=("333", q3))
  
      t1.start()
      t2.start()
      t3.start()
  
      t1.join()
      t2.join()
      t3.join()
  
      return (q1.get(),q2.get(),q3.get())
  
  print combine()
  </code></pre>
  
  <p>this code works. and i get the expected results:</p>
  
  <pre><code>&gt;&gt;&gt; 
  (111, 222, 333)
  </code></pre>
  
  <p>however, there must be a better way to do this.
  i plan on having many more threads than 3, but even if i was only staying with 3 - it seems very ugly.</p>
  
  <p><strong>EDIT:</strong> i need to be able to know which result came from which thread (ie: from which parameters/arguments that i gave the function)</p>