线程与线程 [英] Thread vs. Threading
问题描述
Python中的threading
和thread
模块之间有什么区别?
What's the difference between the threading
and thread
modules in Python?
推荐答案
在Python 3中,thread
已重命名为_thread
.这是用于实现threading
的基础结构代码,而普通的Python代码不应靠近它.
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
公开了底层操作系统级别进程的原始视图.这几乎从来都不是您想要的,因此在Py3k中重命名以表明它实际上只是一个实现细节.
_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
添加了一些附加的自动记帐功能,以及一些便捷实用程序,所有这些实用程序使其成为标准Python代码的首选选项.
threading
adds some additional automatic accounting, as well as several convenience utilities, all of which makes it the preferred option for standard Python code.
这篇关于线程与线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!