[issue40387] queue example is a sketch

2020-04-26 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40387] queue example is a sketch

2020-04-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 179f22c3b786ce9baa3445923f8f9708dfa5d5b7 by Miss Islington (bot) 
in branch '3.8':
bpo-40387: Improve queue join() example. (GH-19724) (GH-19726)
https://github.com/python/cpython/commit/179f22c3b786ce9baa3445923f8f9708dfa5d5b7


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40387] queue example is a sketch

2020-04-26 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +19048
pull_request: https://github.com/python/cpython/pull/19726

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40387] queue example is a sketch

2020-04-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 88499f15f547ccf7b15d37b0eaf51cc40bad5c39 by Raymond Hettinger in 
branch 'master':
bpo-40387: Improve queue join() example. (GH-19724)
https://github.com/python/cpython/commit/88499f15f547ccf7b15d37b0eaf51cc40bad5c39


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40387] queue example is a sketch

2020-04-26 Thread Santiago Blanco


Santiago Blanco  added the comment:

That is pretty clear! Thank you Raymond.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40387] queue example is a sketch

2020-04-26 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +19046
pull_request: https://github.com/python/cpython/pull/19724

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40387] queue example is a sketch

2020-04-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm thinking of simplifying the example to focus on its core goal of 
demonstrating how to enqueue tasks and then wait for them to be finished:

import threading, queue

q = queue.Queue()

def worker():
while True:
item = q.get()
print(f'Working on {item}')
print(f'Finished {item}')
q.task_done()

# turn-on the worker thread
worker_thread = threading.Thread(target=worker)
worker_thread.daemon = True
worker_thread.start()

# send thirty task requests to the worker
for item in range(30):
q.put(item)
print('All task requests sent\n', end='')

# block until all tasks are done
q.join()
print('All work completed')

--
assignee: docs@python -> rhettinger
title: queue example it does not work -> queue example is a sketch
versions:  -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com