read and readline hanging

Olivier Lefevre lefevrol at yahoo.com
Mon Jan 28 14:52:54 EST 2008


>> But in python eventually stdout.readline() hangs. This is a real 
>> nuisance: why can't it just return None?
> 
> Because that would be quite annoying because most of the time people want
> blocking behavior.

Just an afterthought: do people prefer the blocking behaviour because
blocking until there's something to read is more economical of computer
resources than polling for a non-null read (what I was trying to do, in
effect)? The problem with polling is you need a minimum of 2 threads to
do anything useful: it is quite inconvenient to block in the main thread.

-- O.L.




More information about the Python-list mailing list