[docs] [issue31739] socket.close recommended but not demonstrated in same-page example code
R. David Murray
report at bugs.python.org
Tue Oct 17 22:12:55 EDT 2017
R. David Murray <rdmurray at bitdance.com> added the comment:
Heh, of course the socket server also only ends with ctl-C. And I misread the CAN example, it won't spin because the read isn't wrapped in a try/except. So yes, that should use a with on the socket as well, since the with will close the socket on a ctl-C, unlike a close statement after the loop which will never be reached.
Python tracker <report at bugs.python.org>
More information about the docs