title: Threading in python: retrieve return value when using target=
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1886090/return-value-from-thread">Return value from thread</a>  </p>
  </blockquote>
  
  
  
  <p>I want to get the "free memory" of a bunch of servers like this:</p>
  
  <pre><code>def get_mem(servername):  
      res = os.popen('ssh %s "grep MemFree /proc/meminfo | sed \'s/[^0-9]//g\'"' % servername)  
      return res.read().strip()  
  </code></pre>
  
  <p>since this can be threaded I want to do something like that:</p>
  
  <pre><code>import threading  
  thread1 = threading.Thread(target=get_mem, args=("server01", ))  
  thread1.start()
  </code></pre>
  
  <p>But now: how can I access the return value(s) of the get_mem functions?
  Do I really need to go the full fledged way creating a <code>class MemThread(threading.Thread)</code> and overwriting <code>__init__</code> and <code>__run__</code>?</p>