It's common to create multiple threads, start them, and then join them. Example:
threads = [
threading.Thread(target=run_a),
threading.Thread(target=run_b),
]
for thread in threads:
thread.start()
...
for thread in threads:
thread.join()
I propose adding a start=False parameter to threading.Thread to start immediately the thread. The example would become:
threads = [
threading.Thread(target=run_a, start=True),
threading.Thread(target=run_b, start=True),
]
...
for thread in threads:
thread.join()
The new parameter would solve the old issue gh-93293 which requests to return self in start(). The issue example:
threads = []
for i in range(10):
thread = threading.Thread(target=fn, args=(i,))
thread.start()
threads.append(thread)
for t in threads:
t.join()
would become:
threads = [threading.Thread(target=fn, args=(i,), start=True) for i in range(10)]
for t in threads:
t.join()
Linked PRs
It's common to create multiple threads, start them, and then join them. Example:
I propose adding a start=False parameter to threading.Thread to start immediately the thread. The example would become:
The new parameter would solve the old issue gh-93293 which requests to return self in
start(). The issue example:would become:
Linked PRs