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

Guido van Rossum guido at python.org
Wed Mar 7 03:30:52 CET 2007


On 3/6/07, Adam Olsen <rhamph at gmail.com> wrote:
> On 3/6/07, Guido van Rossum <guido at python.org> wrote:
> > The buffering layer could then raise IOError (or perhaps a special
> > subclass of it) if the raw I/O layer ever returned one of these;
>
> 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?

ValueError would mean that the specific call to read() or write() had
invalid argument values. IOError means that there's an I/O-related
error, which means that it's somewhat expected during normal
operation; *anything* I/O related raises IOError (even if you had
closed the file descriptor behind the file's back). ValueError is
typically a bug in the immediate code containing the call. IOError is
something that could happen even to valid calls (e.g. when a library
is passed a stream that happens to have been put in nonblocking mode;
if the library has a recovery for other I/O errors like disk full or
broken connections, the recovery should be applied in this case, too).

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list