[Python-3000] Non-blocking I/O? (Draft PEP for New IO system)

Daniel Stutzbach daniel at stutzbachenterprises.com
Wed Mar 7 03:52:09 CET 2007


On 3/6/07, Adam Olsen <rhamph at gmail.com> wrote:
> What's the rationale for IOError instead of ValueError?  Isn't it an
> error in the application to apply the buffering layer to a
> non-blocking socket, and not something related to a connection reset?

The buffering layer can't easily detect that the file object is
non-blocking a priori.  It only finds out when a system call returns
-1 and errno is set to EAGAIN.  In the meantime, it might have
actually read or writen some data.  An IOError makes it more clear
that something went awry, while a ValueError typically implies that
the operation was rejected altogether.

-- 
Daniel Stutzbach, Ph.D.             President, Stutzbach Enterprises LLC


More information about the Python-3000 mailing list