[Python-Dev] Socket timeout patch
Guido van Rossum
guido@python.org
Fri, 07 Jun 2002 09:19:42 -0400
[Guido]
> > - Should sock.settimeout(0.0) mean the same as sock.setblocking(0)?
> > Currently it sets a timeout of zero seconds, and that behaves pretty
> > much the same as setting the socket in nonblocking mode -- but not
> > exactly. Maybe these should be made the same?
[GregE]
> I'd say no. Someone might want the current behaviour,
> whatever it is -- and if they don't, they can always
> make it properly non-blocking. Don't make a special
> case unless it's absolutely necessary.
Why would someone want the current (as of last night) behavior? IMO
it's useless. The distinction with non-blocking mode is very minimal.
[Neal]
> Another possibility would be to make settimeout(0.0) equivalent to
> settimeout(None), ie disable timeouts.
Hm, but a zero really does smell more of non-blocking than of
blocking. It would also be inconsistent with the timeout argument to
select(), which currently uses None for blocking, 0 for non-blocking,
and other positive numbers for a timeout in seconds -- just like
settimeout().
--Guido van Rossum (home page: http://www.python.org/~guido/)