S
Steven D'Aprano
Using Python 3, are range_iterator objects thread-safe?
I have tried this, and it seems to be safe:
.... print("result =", next(x))
....
....
result = 0
result = 1
result = 2
result = 3
I have tried this, and it seems to be safe:
.... print("result =", next(x))
....
.... t.start()threads = [Thread(target=doit, args=(x,)) for i in range(4)]
for t in threads:
....
result = 0
result = 1
result = 2
result = 3