[Python-Dev] xreadlines : readlines :: xrange : range

Guido van Rossum guido@python.org
Tue, 02 Jan 2001 18:06:16 -0500


> I haven't followed this thread closely, and my brain is a bit frazzled at
> the moment, but is there some fundamental reason that the file object's
> readlines method can't be made lazy, perhaps only when given a sizehint?

Yes -- readlines() is documented to return a list, and some people do
things to it that require it to be a real list (e.g. sort or reverse
it or modify it in place or concatenate it with other lists).

--Guido van Rossum (home page: http://www.python.org/~guido/)