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

2009-06-10 Thread Frederick Reeve
y. The need to
hold a bytestring to the next iteration would be done away with as well.
Other pieces of data handling would also be simpler.

2. Speed

It would require less handling in the "slower" interpreter if we would
use the buffer in the buffered reader.  Also, all that logic mentioned
in 1 is moved to the faster C code or done away with.  There is very
little necessity for peek outside of parsers, so speed in read-through
and random reads would not have to be affected.

I have other reasons and arguments, but I want to know what every one
else thinks.  This will most likely show me what I have missed or am
not seeing, if anything.  Please I have babbled enough.

Thanks so much for the consideration.

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


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

2009-06-12 Thread Frederick Reeve
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


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

2009-06-16 Thread Frederick Reeve
On Sat, 13 Jun 2009 12:33:46 + (UTC)
Antoine Pitrou  wrote:

> This proposal looks reasonable to me. Please note that it's too late for 3.1
> anyway - we're in release candidate phase. Once you have a patch, you can post
> it on the bug tracker.

Thanks I will do that.  Sometime in the next couple of weeks.

Gratefully

Frederick
___
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