[Patches] [Patch #102915] xreadlines : readlines :: xrange : range

noreply@sourceforge.net noreply@sourceforge.net
Mon, 18 Dec 2000 19:32:10 -0800


Patch #102915 has been updated. 

Project: python
Category: Modules
Status: Open
Submitted by: jepler
Assigned to : nobody
Summary: xreadlines : readlines :: xrange : range

Follow-Ups:

Date: 2000-Dec-18 19:32
By: jepler

Comment:
This patch implements an object 'xreadlines' in C, as well as a method on the file object to create one.

xreadlines will let a 'for' loop iterate over the contents of a file without reading the whole file, yet at a speed almost equal to that of 'for line in f.readlines()'.  Internally, it uses f.readlines(sizehint).

Includes a test suite and a version of fileinput which uses it (approx. 50% speedup in fileinput as well).  fileinput is not tested by test suite entry.
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=102915&group_id=5470