Perl vs. Python for text manipulation
John J. Lee
jjl at pobox.com
Sat Jan 24 10:25:24 EST 2004
Ganesan R <rganesan at myrealbox.com> writes:
> > Is that all that people mean, though, when they talk about Perl's
> > superiority for text mangling? Is there more to it? --
[...]
> The perl "built-in" idioms for text processing is not only a syntactic
> convenience, there are real performance advantages. For example a simple
> perl loop like
>
> while (<>) { }
>
> is nearly 6 times slower in python (8 time slower with Python 2.2) using
[...]
Did you try 'for line in file:'? ISTR Tim Peters optimized that (or
was that fileinput?), precisely because of every hacker and their dog
running this as a benchmark.
John
More information about the Python-list
mailing list