title: Threading and delegates - multithreading with class
body: <p>I can make the below example to run on a different thread (for every function I'm calling) but I'm having a problem when I'm trying to combine it with Classes and delegation.</p>
  
  <p>In the below example calling <code>threading.current_thread()</code> into the classes, I always get the same thread.</p>
  
  <p>Any ideas why this is happening?</p>
  
  <pre><code>import threading
  import time
  
  class FirstClass(threading.Thread):
  
      def __init__(self, obj):
          threading.Thread.__init__(self)
          self.obj = obj
          print(threading.current_thread())
  
  
      def compute(self, num_list):
          for n in num_list:
              time.sleep(0.2)
              print("Square: {}".format(n*n))
              self.obj.print_it(n)
  
  
  class SecondClass(threading.Thread):
  
      def __init__(self):
          threading.Thread.__init__(self)
          print(threading.current_thread())
  
  
      def print_it(self, n):
          time.sleep(0.2)
          print("Cube: {}".format(n*n*n))
  
  
  
  
  
  t = time.time()
  t1 = SecondClass()
  t2 = FirstClass(t1)
  t2.compute([1,2,3,4,5])
  
  t1.start()
  t2.start()
  
  t1.join()
  t2.join()
  
  print("Done in: {}".format(time.time()-t))
  </code></pre>