title: Why this 10 threads always output the same thread name?
body: <p>I ran this code</p>
  
  <pre><code>NUM = 0
  def count():
      global NUM
      NUM += 1
      time.sleep(1)
      print(t.getName()+":"+"NUM is "+str(NUM))
  
  for i in range(10):
      t = threading.Thread(target=count)
      t.start()
  </code></pre>
  
  <p>The output is</p>
  
  <pre><code>Thread-10:NUM is 10
  Thread-10:NUM is 10
  Thread-10:NUM is 10
  Thread-10:NUM is 10
  Thread-10:NUM is 10
  Thread-10:NUM is 10
  Thread-10:NUM is 10
  Thread-10:NUM is 10
  Thread-10:NUM is 10
  Thread-10:NUM is 10
  </code></pre>
  
  <p>I know why the NUM is always 10, but why is the thread name always the same? Every thread runs <code>print(t.getName()+":"+"NUM is "+str(NUM))</code>; the <code>t</code> should not be the thread that gets the cpu time's one?  I think the name should not be the same.</p>
  
  <p>When I changed to this </p>
  
  <pre><code>NUM = 0
  def count():
      global NUM
      NUM += 1
      name = t.getName()
      time.sleep(1)
      print(name+":"+"NUM is "+str(NUM))
  
  for i in range(10):
      t = threading.Thread(target=count)
      t.start()
  </code></pre>
  
  <p>It works as I expect:</p>
  
  <pre><code>Thread-1:NUM is 10
  Thread-3:NUM is 10
  Thread-2:NUM is 10
  Thread-4:NUM is 10
  Thread-5:NUM is 10
  Thread-7:NUM is 10
  Thread-10:NUM is 10
  Thread-9:NUM is 10
  Thread-6:NUM is 10
  Thread-8:NUM is 10
  </code></pre>