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

Glenn Linderman v+python at g.nevcal.com
Tue Jun 16 21:08:04 CEST 2009


On approximately 6/16/2009 11:20 AM, came the following characters from 
the keyboard of Scott David Daniels:
> MRAB wrote:
>> I was thinking along the lines of:
>>     def peek(self, size=None, block=True)
>> If 'block' is True then return 'size' bytes, unless the end of the
>> file/stream is reached; if 'block' is False then return up to 'size'
>> bytes, without blocking....
> 
> I tend to prefer zero-ish defaults, how about:
>     def peek(self, size=None, nonblocking=False)


No, no, no!  Double negatives are extremely easy to not code correctly. 
  The lack of ease of not understanding of code containing double 
negatives quadruples, at least!  Not so differently, I'm sure my 
sentences here are not easy to understand because I put the inverse 
logic in them in the places that are not the usual.

-- 
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking


More information about the Python-Dev mailing list