[Python-Dev] blocking a non-blocking socket

Bill Janssen janssen at parc.com
Mon Dec 3 03:04:34 CET 2007


> Rather than temporarily
> making it blocking by whatever means, some indication needs
> to be returned that the operation would block, and a way
> provided for the calling code to re-try later.
> 
> If that can't reasonably be done, then passing a non-blocking
> socket here should be an error.

I tend to agree with you.  At this point, we're executing bad code,
because passing in a non-blocking socket and asking the routine to do
the handshake is self-contradictory.  Checking for this condition and
raising an exception would probably be best.  Other opinions.

> > But my mother taught me never to test for equality against
> > floating-point zero.
> 
> That doesn't apply here. If a float is explicitly set to 0.0
> you can reasonably expect it to test equal to 0.0. The caveat
> only applies to results of a calculation, which may incorporate
> roundoff errors.

Yep.  Sorry, meant to imply that with the next sentence.

Bill



More information about the Python-Dev mailing list