Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 872b79d

Browse files
committed
Add a comment explaining why SocketIO is needed
1 parent f77c1d6 commit 872b79d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/socket.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ class SocketIO(io.RawIOBase):
228228
the raw I/O interface on top of a socket object.
229229
"""
230230

231+
# One might wonder why not let FileIO do the job instead. There are two
232+
# main reasons why FileIO is not adapted:
233+
# - it wouldn't work under Windows (where you can't used read() and
234+
# write() on a socket handle)
235+
# - it wouldn't work with socket timeouts (FileIO would ignore the
236+
# timeout and consider the socket non-blocking)
237+
231238
# XXX More docs
232239

233240
def __init__(self, sock, mode):

0 commit comments

Comments
 (0)