A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-September/082160.html below:

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

[Python-Dev] fileobj.read(float): warning or error? [Python-Dev] fileobj.read(float): warning or error?Greg Ewing greg.ewing at canterbury.ac.nz
Wed Sep 3 02:49:17 CEST 2008
Jesus Cea wrote:

> How do you differenciate between that empty string (when doing
> "read(0)"), from EOF (that is signaled by an empty string)?.

If you need to be able to make that distinction, then
you have to be careful not to try to read 0 bytes.

Personally I've never come across a situation where
allowing read(0) to occur would have simplified the
code. In the usual keep-reading-until-we've-got-the-
required-number-of-bytes scenario, you're checking
for 0 bytes left to read in order to tell when to
stop.

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4