On 16Jun2009 02:18, MRAB <pyt...@mrabarnett.plus.com> wrote:
>> My itch is that peek() _feels_ like it should be "look into the buffer"
>> but actually can block and/or change the buffer.
>>
> Can block, but not if you don't want it too. You might just want to see
> what, if anything, is currently available, up to n bytes.

Am I missing something?

In the face of an _empty_ buffer (which I can't tell from outside) how
do I prevent peek() blocking? More generally, if I go peek(n) and if n >
bytes_in_buffer_right_now and the raw stream would block if a raw read
is done?

My concerns would go away if I could probe the buffer content size;
then I could ensure peek(n) chose n <= the content size. If that's not
enough, my problem - I can choose to read-and-block or go away and come
back later.
-- 
Cameron Simpson <c...@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

If all around you is darkness and you feel you're contending in vain,
then the light at the end of the tunnel is the front of an oncoming train.
_______________________________________________
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