STINNER Victor <victor.stinner@haypocalc.com> added the comment:
Is it unclear to you what those mean?
Well, it's clear, but I like when I can simply copy/paste the example and it does just work:
If you post a high-quality self-contained example somewhere on the net, I would be happy to link to it.
I just propose to change the example to stop the threads: ------------------ def worker(): while True: item = q.get() if item is None: break do_work(item) q.task_done() q = Queue() threads = [] for i in range(num_worker_threads): t = Thread(target=worker) threads.append(t) t.start() for item in source(): q.put(item) q.join() # block until all tasks are done for i in range(num_worker_threads): q.put(None) for t in threads: t.join() ------------------ ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue12155> _______________________________________