[Python-Dev] fileobj.read(float): warning or error?

John J Lee jjl at pobox.com
Wed Jul 23 00:45:56 CEST 2008


On Wed, 23 Jul 2008, Cameron Simpson wrote:
> On 22Jul2008 20:56, John J Lee <jjl at pobox.com> wrote:
>> On Tue, 22 Jul 2008, Cameron Simpson wrote:
>> [...]
>>> Leaving aside the 0.2 => 0 converstion, shouldn't read() raise an
>>> exception if asked for < 1 bytes? Or is there a legitimate use for read(0)
>>> with which I was not previously aware?
>>
>> http://docs.python.org/lib/bltin-file-objects.html
>>
>> read([size])
>>
>> ... If the size argument is negative or omitted, read all data until EOF
>> is reached. ...
>
> Hmm, yeah, but 0 is not negative and not omitted so this does not apply.

Well, -1 *is* < 1 (and is in the domain of the function), but yes -- 
sorry, read too quickly, took your "< 1" too literally.


John



More information about the Python-Dev mailing list