while c = f.read(1)

Antoon Pardon apardon at forel.vub.ac.be
Tue Aug 23 08:06:05 EDT 2005


Op 2005-08-23, rafi schreef <rafi at free.fr>:
> Antoon Pardon wrote:
>
>> In that case you wouldn't return an empty sequence if you wanted
>> a false value in a sequence context but would throw an exception.
>> So this would be fine by me, I just don't understand how this
>> would support the use of empty sequences as false.
>> 
>> I also don't see how a read from a network connection returning
>> either:
>> 
>>   a bytestring    when data is available, 
>>   ''              when no data is available
>>   None            when the connection was closed
>
> I do not get why returning '' when no data is available? If no data is 
> available then nothing is returned, the function hangs. (Which is the 
> cas for receive)

Network connections can be configured to either block or return
immediatly when no data is available.

-- 
Antoon Pardon



More information about the Python-list mailing list