Comparing Perl and Python

Standing at a Perl booth at technical events gives you a lot of opportunities to talk to nice people. They often ask how do Perl and Python compare. I try to be diplomatic, even if that does not always work. Here is what I tend to answer:

Size and complexity

Perl, the language is much larger than Python so probably it takes longer time to learn Perl than Python but in the end you have a more expressive language.

The standard libraries of Python cover a lot more fields than those of Perl as Python has an approach of batteries included while Perl is now following a "small core" approach. This makes it easier to distribute simple applications written in Python as they have a better chance of not needing any external dependencies except a specific version of Python.

On the other hand CPAN is the killer feature of Perl. It has a lot more extensions than Python has. It has a central location with a standardized installation process and a standardized way of installing dependencies.

Lastly on the application development level it seems that you can find a lot more application frameworks and a lot more ready made applications written in Python than in Perl.

Approach and community

That's one direction of comparing the two languages. The other one is the general approach to things. Python programmers have the idea of There should be one obvious way to solve a problem while Perl programmers tend to think in TMTODWDI - There's More Than One Way To Do It.

This leads to an interesting clash in the cultures. People who prefer more centralized governing will tend to use Python and think that it is the right way to do things. Seeing people use Perl makes them nervous or even aggressive.

On the other hand Perl programmers will think there is more than one way to do things. One of them can be Python.

This can give them a much more relaxed approach.

At least I hope so.

Published on 2010-06-17 by Gabor Szabo