title: get thread ID or name in python 2.6
body: <p>I am trying to get thread ID or name in python 2.6 I follow examples but I get errors
   like 
  global name 'currentThread' is not defined
  global name 'current_thread' is not defined</p>
  
  <p>(I tried both currentThread and current_thread)</p>
  
  <p>Here is my code :</p>
  
  <pre><code>vim f3Q.py
    1 import Queue
    2 from threading import Thread
    3
    4 def do_work(item):
    5         try:
    6                 print current_thread().getName()
    7
    8
    9         except Exception as details:
   10                 print details
   11                 pass
   12         print item*2
   13
   14 def worker():
   15         while True:
   16                 item=q.get()
   17                 do_work(item)
   18                 q.task_done()
   19
   20 q=Queue.Queue()
   21 l=[13,26,77,99,101,4003]
   22 for item in l:
   23         q.put(item)
   24
   25
   26 for i in range (4):
   27         t=Thread(target=worker,name="child"+str(i))
   28         t.daemon=True
   29         t.start()
   30
   31
   32 q.join()
   33
  </code></pre>
  
  <p>UPDATE:
  I fixed the error by the hint Mata gave
  I should have imported current_thread() too.</p>
  
  <pre><code>from threading import Thread,current_thread
  </code></pre>