This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: HOWTO for socket programming and select documentation contradict
Type: behavior Stage:
Components: Documentation Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: AlexWaygood, docs@python, giampaolo.rodola, neologix
Priority: normal Keywords:

Created on 2021-11-11 17:56 by AlexWaygood, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg406167 - (view) Author: Alex Waygood (AlexWaygood) * (Python triager) Date: 2021-11-11 17:56
The HOWTO for socket programming in Python (https://docs.python.org/3/howto/sockets.html#non-blocking sockets) includes the following lines (using triple-quotes here to indicate multiline quotes from the docs):

"""
The major mechanical difference [between blocking and non-blocking sockets] is that [for non-blocking sockets] send, recv, connect and accept can return without having done anything. You have (of course) a number of choices. You can check return code and error codes and generally drive yourself crazy. If you don’t believe me, try it sometime. Your app will grow large, buggy and suck CPU. So let’s skip the brain-dead solutions and do it right.

Use select.
"""

However, if you go to the documentation for the select module (https://docs.python.org/3/library/select html), it pointedly tells you at the top *not* to do exactly what the socket HOWTO tells you to do:

"""
Note The selectors module allows high-level and efficient I/O multiplexing, built upon the select module primitives. Users are encouraged to use the selectors module instead, unless they want precise control over the OS-level primitives used.
"""
History
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 89945
2021-11-11 17:56:34AlexWaygoodcreate