Thread vs. Threading Thread vs. Threading multithreading multithreading

Thread vs. Threading


In Python 3, thread has been renamed to _thread. It is infrastructure code that is used to implement threading, and normal Python code shouldn't be going anywhere near it.

_thread exposes a fairly raw view of the underlying OS level processes. This is almost never what you want, hence the rename in Py3k to indicate that it is really just an implementation detail.

threading adds some additional automatic accounting, as well as several convenience utilities, all of which makes it the preferred option for standard Python code.


threading is just a higher level module that interfaces thread.

See here for the threading docs:

http://docs.python.org/library/threading.html


If I'm not mistaken, thread allows you to run a function as a separate thread, whereas with threading you have to create a class, but get more functionality.

EDIT: This is not precisely correct. threading module provides different ways of creating a thread:

  • threading.Thread(target=function_name).start()
  • Create a child class of threading.Thread with your own run() method, and start it