20 Stages of Perl to Python Conversion

Mike Rovner mike at bindkey.com
Fri Aug 16 20:38:50 CEST 2002

"Andrew Dalke" <dalke at dalkescientific.com> wrote in message
news:3D5C9663.9090205 at dalkescientific.com...
> Or, more generically, write the Perl flavored Python code and
> complain that it's complicated, verbose, and slow compared to
> the original Perl code.  Then after talking with someone with
> a bit more Python experience, you realize there is a more
> Pythonic way which fixes all those problems.

Well, it's really more slow.
I had a small (in number of lines) project which shall compare tens-megabyte
text files.

First it seems a perl task. So I implemented it on perl, run several times
and forget.
Later on the guy who needed it came again and asked for couple new features.
So I reimplemented it on python.

First good thing was I immediately recovered 3 bugs in first implementation
because perl
try to use defaults everywhere, so they went indiscovered.
Second of cause was ease to add that new features, but trade of was speed.
Even using compiled re doesn't save me. Speed was about 2 times slower then
perl without //o

But anyway the guy was impressed by two-day implementation instead of whole
month C++ programming. :))


More information about the Python-list mailing list