classification
Title: Socket documentation threading misstep?
Type: Stage:
Components: Documentation Versions: Python 3.7, Python 3.6, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: apoplexy, docs@python, r.david.murray
Priority: normal Keywords:

Created on 2017-10-06 15:53 by apoplexy, last changed 2017-10-06 17:00 by apoplexy.

Messages (4)
msg303831 - (view) Author: Phillip (apoplexy) Date: 2017-10-06 15:53
Very small, but,

https://docs.python.org/2/howto/sockets.html
https://docs.python.org/3/howto/sockets.html

have :
while True:
    # accept connections from outside
    (clientsocket, address) = serversocket.accept()
    # now do something with the clientsocket
    # in this case, we'll pretend this is a threaded server
    ct = client_thread(clientsocket)
    ct.run()

and for some reason I really want it to be ct.start()
msg303834 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-10-06 16:37
Based on the paragraph following the example, I don't think client_thread is a threading.Thread, and 'run' is meant to be a generic representation of a possible API.  Since Threads do have a 'run' method, this is certainly potentially confusing.  Maybe we should change it to 'start_thread' or something like that?
msg303835 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-10-06 16:44
Or maybe instead of client_handler/run, it should be something like handle_client_asynchronously(clientsocket).
msg303838 - (view) Author: Phillip (apoplexy) Date: 2017-10-06 17:00
I could definitely understand that. After all, if it's slightly askew (or
strikes some as such) it forces critical thinking, which is good. I didn't
think calling run() was indicative of the three likely pathways to handle
the client socket in the following paragraph.

I'm indifferent, I just saw something so I said something, but ultimately I
think you guys do a tremendous job keeping this documentation good.

Thanks,

On Fri, Oct 6, 2017 at 10:44 AM, R. David Murray <report@bugs.python.org>
wrote:

>
> R. David Murray <rdmurray@bitdance.com> added the comment:
>
> Or maybe instead of client_handler/run, it should be something like
> handle_client_asynchronously(clientsocket).
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue31717>
> _______________________________________
>
History
Date User Action Args
2017-10-06 17:00:05apoplexysetmessages: + msg303838
2017-10-06 16:44:05r.david.murraysetmessages: + msg303835
2017-10-06 16:37:18r.david.murraysetnosy: + r.david.murray

messages: + msg303834
versions: - Python 3.4, Python 3.5, Python 3.8
2017-10-06 15:53:09apoplexycreate