title: multithreading using python
body: <p>Trying to understand the following results when using multithreading with python. The following code prints A and B to the console in random sequence, which is what I would like to achieve. But the second piece of code only prints "A" to the console, and never proceeds past t1.start(). Why is this? What do I need to do the the second section of code to make it behave like the first?</p>
  
  <p>Thanks in advance, this is my first post.</p>
  
  <p>This is the behavior I want :</p>
  
  <pre><code>from threading import Thread
  def runA():
      while True:
          print ('A\n')
  
  def runB():
      while True:
          print ('B\n')
  
  if __name__ == "__main__":
       t1 = Thread(target = runA())
       t2 = Thread(target = runB())
       t1.setDaemon(True)
       t2.setDaemon(True)
       t1.start()
       t2.start()
       while True:
           pass
  </code></pre>
  
  <p>I want the behavior produced from the above code but using classes like in the example below. The code below never executes t2.start(). Why is this?</p>
  
  <pre><code>from threading import Thread
  class test():
       def runA(self):
           while True:
               print ('A\n')
  
       def runB(self):
           while True:
               print ('B\n')
  
  if __name__ == "__main__":
       testingNow=test()
       t1 = Thread(target = testingNow.runA())
       t2 = Thread(target = testingNow.runB())
       t1.setDaemon(True)
       t2.setDaemon(True)
       t1.start()
       t2.start()
       while True:
           pass
  </code></pre>