pep 3116 behaviour on non-blocking reads
greg
greg at cosc.canterbury.ac.nz
Fri Aug 10 04:58:40 EDT 2007
Antoon Pardon wrote:
> I would like the developers to reconsider and return 0 bytes when no
> bytes are available and let None indicate end of file.
That would be a major departure from the way IO has
always been handled before in Python, which follows
the Unix model.
Also, only code that deals with non-blocking streams
will ever get None, and such code is relatively rare,
so most code won't have to worry about the None case.
Even when dealing with a non-blocking stream, usually
there will be some other way (such as select) used to
determine when there is something to be read from a
stream, and it won't be read otherwise. In that case,
the code *still* won't ever see a None.
So I think the PEP has it right.
--
Greg
More information about the Python-list
mailing list