[Python-Dev] fileobj.read(float): warning or error?

Isaac Morland ijmorlan at cs.uwaterloo.ca
Wed Sep 3 14:55:33 CEST 2008


On Wed, 3 Sep 2008, Greg Ewing wrote:

>> > The Unix read() system call doesn't treat EOF as special other than it
>> > won't return bytes from "beyond" EOF and therefore even when reading a
>> > regular file could return fewer (including 0) bytes than asked for in
>> > the call.
>
> No, that's not right -- a read of more than 0 bytes will
> always block until at least 1 byte is available, or
> something happens that counts as an EOF condition.
>
> However, with some devices it's possible for what
> counts as EOF to happen more than once, e.g. ttys.

Sorry, you're absolutely right.  I was thinking only of the fact that 
read() at EOF is not an error, rather than the blocking behaviour.  It 
sounds like Python read() really is very similar to Unix read() in 
behaviour.

Isaac Morland			CSCF Web Guru
DC 2554C, x36650		WWW Software Specialist


More information about the Python-Dev mailing list