Python versus Perl ?

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Sun Feb 6 09:11:26 EST 2005


surfunbear at yahoo.com wrote:
>  I've read some posts on Perl versus Python and studied a bit of my
> Python book.
> 
>  I'm a software engineer, familiar with C++ objected oriented
> development, but have been using Perl because it is great for pattern
> matching, text processing, and automated testing. Our company is really
> fixated on risk managnemt and the only way I can do enough testing
> without working overtime (which some people have ended up doing) is by
> automating my testing. That's what got me started on Perl.
> 
>  I've read that many people prefer Python and that it is better than
> Perl. However, I want to ask a few other questions.

"Better than Perl" is a very general statement. In my personal opinion,
this is true for every project being larger than one file of ~200 LOC.

> 1. Perl seems to have alot of packaged utilities available through
> CPAN, the comprehensive perl network. These can aid in building
> parsers, web development, perl DBI is heavily used. This seems to be a
> very important benifit. I'm not sure that Python is as extenive at all
> in that regard ?

There are the Python Package Index (PyPI), the Vaults of Parnassus, and
when you don't find a needed package there, just come and ask here;
almost always a decent solution is found.

A thing similar to CPAN is being worked on by various people, though I
don't know when it will become mature.

> Perl also has excellent pattern matching compared to
> sed, not sure about how Python measures up,
>  but this seems to make perl ideally suited to text processing.

Python has regular expressions much like Perl. The only difference is
that Perl carries syntactic support for them, while in Python regular
expressions are ordinary objects with methods etc.

> 2. Python is apparantly better at object oriented. Perl has some kind
> of name spacing, I have used that in a limited way. Does Perl use a
> cheap and less than optimal Object oriented approach ?
> That was what someone at work said, he advocates Python.
> Is it likely that Perl will improve it's object oriented features
> in the next few years ?

There is the Perl 6 movement, but when you read some of the docs at
http://dev.perl.org, you will come to the conclusion that

- Perl 6 lies at least 3-5 years in the future and
- it will be a huge mess. Someone here once said "Perl 6 is the ultimate
failure of Perl's philosophy". There may be split views about this...

> 3. Perl is installed on our system and alot of other systems.
> You don't have to make sys admins go out of there way to make it
> available. It's usualy allready there.

Same goes with Python; it is installed per default on most modern
Unices. Windows is a completely different chapter, however, Perl isn't
more widespread there.

> I also did a search of job
> postings on a popular website. 108 jobs where listed that require
> knowledge of Perl, only 17 listed required Python. Becomeing more
> familiar with Perl might then be usefull for ones resume ?

It doesn't harm, of course. Recent statistics about programmers'
salaries indicate, however, that Python ranks top (I somehow lost the URL).

> If Python is better than Perl, I'm curious how really significant
> those advantages are ?

Try to decide yourself. The Python tutorial and website are your friends.

Reinhold



More information about the Python-list mailing list