[Python-3000] iostack and sock2

Nick Coghlan ncoghlan at gmail.com
Tue Jun 6 11:51:32 CEST 2006


Greg Ewing wrote:
> tomer filiba wrote:
> 
>> okay, i give up on read(n) returning n bytes.
> 
> An idea I had about this some time ago was that read()
> could be callable with two arguments:
> 
>    f.read(min_bytes, max_bytes)
> 
> The two variations we're considering would then be special
> cases of this:
> 
>    f.read(0, num_bytes)         # current read() behaviour
> 
>    f.read(num_bytes, num_bytes) # record-oriented read() behaviour

You can even makes this backwards compatible by having the min_bytes argument 
default to 0. (whether or not the order of the two arguments should be 
reversed in that case is debatable, though)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list