title: Python threading.local() not working in Thread class
body: <p>In Python3.6, I use threading.local() to store some status for thread.
  Here is a simple example to explain my question:</p>
  
  <pre><code>    import threading
  
      class Test(threading.Thread):
          def __init__(self):
              threading.Thread.__init__(self)
              self.local = threading.local()
              self.local.test = 123
  
          def run(self):
              print(self.local.test)
  </code></pre>
  
  <p>When I start this thread:</p>
  
  <pre><code>t = Test()
  t.start()
  </code></pre>
  
  <p>Python gives me an error: </p>
  
  <pre><code>AttributeError: '_thread._local' object has no attribute 'test'
  </code></pre>
  
  <p>It seems the <strong>test</strong> atrribute can not access out of the <strong>__init__</strong> function scope, because I can print the value in the <strong>__init__</strong> function after local set attribute <strong>test=123</strong>.</p>
  
  <p>Is it necessary to use threading.local object inside in a Thread subclass? I think the instance attributes of a Thread instance could keep the attributes thread safe.</p>
  
  <p>Anyway, <strong>why the threading.local object not work as expected between instance function?</strong></p>