Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why was the 'thread' module renamed to '_thread' in Python 3.x?

Python 3.x renamed the low-level module 'thread' to '_thread' -- I don't see why in the documentation. Does anyone know?

like image 238
Sridhar Ratnakumar Avatar asked Jul 17 '09 01:07

Sridhar Ratnakumar


People also ask

What is the difference between thread and threading in Python?

The module "Thread" treats a thread as a function, while the module "threading" is implemented in an object oriented way, i.e. every thread corresponds to an object.

What is threading in python3?

A thread is a lightweight process that ensures the execution of the process separately on the system. In Python 3, when multiple processors are running on a program, each processor runs simultaneously to execute its tasks separately.

What is thread and threading module in Python?

Thread in a computer program is an execution path. Threading is creating additional independent execution paths in your program. Every program starts with at least one execution path/thread. You can create more threads to execute parallel tasks depending on your requirements.

Which Python function can be called to run a thread?

We can then start executing the thread by calling the start() function. The start() function will return immediately and the operating system will execute the function in a separate thread as soon as it is able. And that's all there is to it.


2 Answers

It's been quite a long time since the low-level thread module was informally deprecated, with all users heartily encouraged to use the higher-level threading module instead; now with the ability to introduce backwards incompatibilities in Python 3, we've made that deprecation rather more than just "informal", that's all!-)

like image 124
Alex Martelli Avatar answered Sep 16 '22 20:09

Alex Martelli


It looks like the thread module became obsolete in 3.x in favor of the threading module. See PEP 3108.

like image 20
Edward Dale Avatar answered Sep 19 '22 20:09

Edward Dale