[Python-Dev] RE: [Patches] [Patch #102915] xreadlines : readlines :: xrange : range

Paul Prescod paulp@ActiveState.com
Tue, 02 Jan 2001 02:00:46 -0800


Guido van Rossum wrote:
> 
> ...
> 
> But is everyone's first thought to time the speed of Python vs. Perl?
> Why does it hurt so much that this is a bit slow?

I want to interject here that I asked Jeff to submit this patch because
I don't see it as "a little bit slow." When someone transliterates a
program from one scripting language to another and gets a program that
is two to five times slower that is a big deal!

> But of course suggesting fileinput is also not a great solution --
> it's relatively obscure (since it's not taught by most tutorials,
> certainly not by the standard tutorial).

Fileinput's primary problem is that IIRC, it is even slower than doing
readline yourself!

> > reading-text-files-is-very-common-ly y'rs  - tim
> 
> So is worrying about performance without a good reason...

I don't understand what constitutes good reason. We're talking about a
relatively minor change that will speed up thousands of programs, answer
a frequently asked question from comp.lang.python, obliterate an obscure
idiom and reduce the number of requests for a Python syntax change
(assignment expression) all in one bold sweep. It seemed to me as if it
was a "pure win."

 Paul Prescod