title: Concurrently run two functions that take parameters and return lists?
body: <p>I understand that two functions can run in parallel using <code>multiprocessing</code> or <code>threading</code> modules, e.g. <a href="https://stackoverflow.com/questions/2957116/make-2-functions-run-at-the-same-time">Make 2 functions run at the same time</a> and <a href="https://stackoverflow.com/questions/8753306/python-multiprocessing-for-parallel-processes">Python multiprocessing for parallel processes</a>.</p>
  
  <p>But the above examples only use print function. <strong>Is it possible to run functions that return a list in parallel in python, if so, how?</strong></p>
  
  <p>I've tried with threading:</p>
  
  <pre><code>from threading import Thread
  def func1(x):
      return [i*i for i in x]
  
  def func2(x):
      return [i*i*i for i in x]
  
  nums = [1,2,3,4,5]
  
  p1 = Thread(target = func1(nums)).start()
  p2 = Thread(target = func2(nums)).start()
  
  print p1
  print p2
  </code></pre>
  
  <p>but i got the follow error:</p>
  
  <pre><code>Exception in thread Thread-1:
  Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
      self.run()
    File "/usr/lib/python2.7/threading.py", line 761, in run
      self.__target(*self.__args, **self.__kwargs)
  TypeError: 'list' object is not callable
  
  None
  None
  Exception in thread Thread-2:
  Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
      self.run()
    File "/usr/lib/python2.7/threading.py", line 761, in run
      self.__target(*self.__args, **self.__kwargs)
  TypeError: 'list' object is not callable
  </code></pre>
  
  <p>I've tried inputing <code>args</code> parameter as a tuple, instead of a variable:</p>
  
  <pre><code>import threading
  from threading import Thread
  
  def func1(x):
      return [i*i for i in x]
  
  def func2(x):
      return [i*i*i for i in x]
  
  nums = [1,2,3,4,5]
  
  p1 = Thread(target = func1, args=(nums,)).start()
  p2 = Thread(target = func2, args=(nums,)).start()
  
  print p1, p2
  </code></pre>
  
  <p>but it only returns <code>None None</code>, the desired output should be:</p>
  
  <p><strong>[out]:</strong></p>
  
  <pre><code>[1, 4, 9, 16, 25] [1, 8, 27, 64, 125]
  </code></pre>