PEP 260: simplify xrange()

Guido van Rossum guido at python.org
Fri Jun 29 08:21:32 EDT 2001


Just van Rossum <just at letterror.com> writes:

> Erm, now that "for line in file" works (in 2.2 that is), doesn't that
> mean that xreadlines() is superfluous? Or: what does xreadlines() offer
> that "for line in file" doesn't?

file.xreadlines() offers nothing except backwards compatibility.
(It's also used internally to *implement* "for line in file:" but
that's an invisible design choice.)

On the other hand, the xreadlines *module* offers fast buffering reads
on any file-like object that supports the readlines(sizehint) method.
It also supports the iterator interface now, serving as its own
interator (I suppose the getitem interface should be deprecated).

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



More information about the Python-list mailing list