[Python-Dev] RE: [Patches] [Patch #102915] xreadlines : readlines ::
xrange : range
Tue, 02 Jan 2001 02:06:24 -0800
Moshe Zadka wrote:
> Adding .readlines(sizehint) to fileinput, and adding a function
> to create something similar to fileinput from a file object (as opposed
> to a file name) would help everyone, and doesn't seem to hard.
> Is there a gotcha I'm just not seeing?
Fileinput is inherently slow because there are too many layers of Python
code. I started to consider ways of inverting the logic so that it only
called into Python when it needed to switch files but it would have been
a much larger patch than Jeff's and I thought that a conservative
approach was important.
Fileinput should someday be optimized but we can easily get a
low-hanging fruit improvement with Jeff's patch.