What happened to thread.start_new_thread in python 3

lemiant picture lemiant · Jun 12, 2011 · Viewed 27.1k times · Source

I liked the ability to turn a function into a thread without the unnecessary line to define a class. I know about _thread, however it appears that you are not supposed to use _thread. Is there a good-practice equivalent of thread.start_new_thread for python 3?

Answer

Amber picture Amber · Jun 12, 2011
threading.Thread(target=some_callable_function).start()

or if you wish to pass arguments,

threading.Thread(target=some_callable_function,
        args=(tuple, of, args),
        kwargs={'dict': 'of', 'keyword': 'args'},
    ).start()