title: Did the threading module change in Python 3? And if so, how?
body: <p>I'm trying to understand the MT in Python. I found an example using <code>threading.Lock</code>. But it generated different outputs in Python 2.7 and Python 3.6, which really confused me.</p>
  
  <p>Here is the code: </p>
  
  <pre><code>import threading
  import time
  import random
  
   class meThread(threading.Thread):
      def run(self):
         global num
         time.sleep(random.randint(1,3))
         num += 1
         print(self.name+'set num to '+str(num))
  
   num = 0
  
   threads = []
   for i in range(5):
      t = meThread()
      threads.append(t)
  
   for i in range(5):
      threads[i].start()
  
   for i in range(5):
      threads[i].join()
  </code></pre>
  
  <p>and the output in Python3.6:</p>
  
  <pre><code>Thread-4set num to 1
  Thread-2set num to 2
  Thread-1set num to 3
  Thread-3set num to 4
  Thread-5set num to 5
  </code></pre>
  
  <p>and the output in Python2.7:</p>
  
  <pre><code>Thread-1set num to 1
  Thread-4set num to 2
  Thread-3set num to 4
  Thread-2set num to 5
  Thread-5set num to 3
  </code></pre>
  
  <p>The output is always the same in 3.6, but in 2.7 it's unexpected if not using <code>threading.Lock</code>. Why? Does the python add a lock to a thread automatically in 3.6?</p>