Perl / python regex / performance comparison

Terry Reedy tjreedy at
Tue Mar 3 22:51:27 CET 2009

Ivan wrote:
> Hello everyone,
> I know this is not a direct python question, forgive me for that, but
> maybe some of you will still be able to help me. I've been told that
> for my application it would be best to learn a scripting language, so
> I looked around and found perl and python to be the nice. Their syntax
> and "way" is not similar, though.
> So, I was wondering, could any of you please elaborate on the
> following, as to ease my dilemma:

Which way are *you* more comfortable with?  There are people who 
regularly use both, and many who do not.

> 1. Although it is all relatively similar, there are differences
> between regexes of these two. Which do you believe is the more
> powerful variant (maybe an example) ?

This is not relevant to your application below.  In any case, the 
differences are in rather esoteric details.
> 2. They are both interpreted languages, and I can't really be sure how
> they measure in speed. In your opinion, for handling large files,
> which is better ?
> (I'm processing files of numerical data of several hundred mb - let's
> say 200mb - how would python handle file of such size ? As compared to
> perl ?)

For one file and simple processing, the time difference should be less 
than the time you spent asking the question.  For complex processing or 
multiple files, a Python user might use numpy, scipy, or other 
pre-written analysis extensions.

> 3. This last one is somewhat subjective, but what do you think, in the
> future, which will be more useful. Which, in your (humble) opinion
> "has a future" ?

Python ;-) at least for me.

Terry Jan Reedy

More information about the Python-list mailing list