Greetings,

I feel the need to point out I made a mistake.  When I wrote my last email I 
said the behavior had changed python3-3.1.  This seems not to be the case.. I 
had made that assumption because I had written code based on the looking at the 
code in _pyio.py as well as the python3 documentation 
(http://docs.python.org/3.0/library/io.html#io.BufferedReader) which seems to 
be wrong on that point or I miss understand.  Anyway I'm sorry about that.

The other point still stands though.  I would like to see peek changed.  I am 
willing to write and submit changes but don't want to unless others agree this 
is a good idea.  So I put forth the implementation at the bottom of this email. 
 If its bad or you don't see the point I may try to clarify but if nobody 
things its good, please just tell me I'm waisting your time, and I will go 
away.  I also apologize my last email was so long.

peek(n):
If n is less than 0, None, or not set; return buffer contents with out
advancing stream position. If the buffer is empty read a full chunk and
return the buffer.  Otherwise return exactly n bytes up to _chunk
size_(not contents) with out advancing the stream position.  If the
buffer contents is less than n, buffer an additional chunk from the
"raw" stream before hand.  If EOF is encountered during any raw read
then return as much as we can up to n. (maybe I should write that in
code form??)

Thanks

Frederick Reeve
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to