[ANN] xreadlines patch on sourceforge

Jeff Epler jepler at inetnebr.com
Tue Dec 19 04:41:55 CET 2000

I've just uploaded my "xreadlines" patch to Sourceforge.  You can
retrieve it from the Patch Manager, and it is my hope that it will
be considered for inclusion in Python 2.1.

xreadlines, inspired by xrange, permits a simple 'for' loop to iterate
over the contents of a file without reading the entire file at once.

xreadlines is both a new extension module, as well as an additional
method on file objects.  It includes an entry for the test suite,
as well as a modified 'fileinput' module which has a >2x speed
improvement by using the xreadlines function.


def wc(filename):
	for line in open(filename).xreadlines():
	return (l,w,c)

Jeff Epler
jepler at inetnebr.com

More information about the Python-list mailing list