[docs] socket docs inconsistency (python 2.7.1 over linux)

Edu Castellano educastellano08 at gmail.com
Thu Sep 15 15:42:45 CEST 2011


Hi,

In the documentation of sockets:
(http://docs.python.org/release/2.7.1/library/socket.html)

*socket.setblocking(flag)*
*Set blocking or non-blocking mode of the socket: if flag is 0, the socket
is set to non-blocking, else to blocking mode. Initially all sockets are in
blocking mode. In non-blocking mode, if a recv() call doesn’t find any data,
or if a send() call can’t immediately dispose of the data, a error exception
is raised; in blocking mode, the calls block until they can proceed.
s.setblocking(0) is equivalent to s.settimeout(0.0); s.setblocking(1) is
equivalent to s.settimeout(None).*
*
*
*socket.settimeout(value)*
*Set a timeout on blocking socket operations. The value argument can be a
nonnegative float expressing seconds, or None. If a float is given,
subsequent socket operations will raise a timeout exception if the timeout
period value has elapsed before the operation has completed. Setting a
timeout of None disables timeouts on socket operations. s.settimeout(0.0) is
equivalent to s.setblocking(0); s.settimeout(None) is equivalent to
s.setblocking(1).*

When I'm trying this, I get an "error exception" in both functions. Should
it be "timeout exception" for settimeout().
I suggest also to raise another type of exception in setblocking(), "empty
buffer"? or something like that.

Regards,

Edu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20110915/85c7a7cb/attachment.html>


More information about the docs mailing list