[Python-3000] io library/PEP 3116 bits
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Jul 31 03:58:01 CEST 2007
skip at pobox.com wrote:
> The other thing I wanted to comment on is the default value for n in the
> various read methods. In some places it's -1 (why not zero? *),
Maybe because reading 0 bytes already has a well-defined
(if not particularly useful) meaning?
You probably wouldn't use it explicitly, but it could
arise as the result of a calculation, and it would then
need to be special-cased if it had a reserved meaning.
> (*) A few days ago at work I saw someone check in a piece of code with
>
> f.read(-1)
That does look strange. Maybe the result of someone
reading the docs and failing to notice that there was
an easier spelling.
--
Greg
More information about the Python-3000
mailing list