Thread vs. Threading

后端 未结 5 1891
耶瑟儿~
耶瑟儿~ 2020-11-29 22:01

What\'s the difference between the threading and thread modules in Python?

5条回答
  •  渐次进展
    2020-11-29 22:29

    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

提交回复
热议问题