[Python-Dev] io.BufferedReader.peek() Behaviour in python3.1

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Jun 19 02:50:27 CEST 2009

Lucas P Melo wrote:

> The problem is that the chosen 
> method to accomplish it would read 2 symbols (bytes) ahead and this guy 
> is using peek() to grab these 2 bytes. The program will seem to work 
> correctly most of the time, but on the 4095th byte read, he would grab 1 
> byte at most using peek()

That's exactly why I think the blocking version should
keep reading until the requested number of bytes is
available (or the buffer is full or EOF occurs).

In other words, the blocking version should be fully
deterministic given knowledge of the buffer size.


More information about the Python-Dev mailing list