On 3/6/07, Adam Olsen <[EMAIL PROTECTED]> wrote:
> On 3/6/07, Guido van Rossum <[EMAIL PROTECTED]> 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/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to