Perl vs Python

From WikiVS, the open comparison website
Jump to: navigation, search
Perl Python
Perl
VS
Python
http://perl.org http://www.python.org

Contents

[edit] Readability

  • Python uses whitespace indentation for defining blocks. This attempts to ensure greater readability for later developers, but visually impaired users go easier with C-like syntaxes.
  • Perl uses a very dynamic approach and its syntax features great flexibility. It gives the programmer many choices about the style, like natural languages do. The programmer can choose to suffix the control statement after an action, to emphasis the action to the reader. For this reason semicolons are required. Perl::Critic provides best practises and can automatically critique code style and to a great degree, its semantics. The perltidy tool can automatically reformat code based on the users preference - empowering the programmer to focus on coding and delegate code aesthetics to automation. Sigils are used for the basic data types. They are context related and can be compared with the Numerus in natural languages.

[edit] Paradigms

  • Python is imperative, object-oriented, functional and also reflective.
  • Perl is imperative, object-oriented, functional and also reflective.

[edit] Web application development

Perl's flagship web application framework is Catalyst, but also others, like Mojolicious are getting quite famous. HTML::Mason provides a more PHP like approach.

Python has for example Django, TurboGears, Pylons, Zope, Quixote, Karrigell and web2py. Here is a near complete Python web application framework list.

[edit] Testing

Most Perl applications and modules come with their own tests, their presence and how exhaustive they test is measured automatically by cpan as part of "kwalitee" standards. "Kwalitee" represents perls never ending quest for greater quality. Basic tools and frameworks for writing test suites are part of Perls core modules, advanced additions to the framework are numerous and can save programmers enormous time in testing.

O'Reilly media publishes a book called "Perl Testing: A Developer's Notebook" which provides a comprehensive introduction and reference to perl testing.

Python modules tend to use either pyunit or nose for unit level testing.

[edit] Libraries/Modules

One of Perl's strengths is CPAN, which contains about 90.000 modules ready to install. There is also a related project called CPAN Testers which aims to increase portability of each module by collecting data about failed and succeeded compilations, tests and installations.

Python's equivalent, [PyPI http://pypi.python.org/pypi] has about 18,000 packages. Automatic installation is done via the easy_install or pip command-line utilities.

[edit] Community

Perl's community is said to be more relaxed and less elitist, than Python's. However, there are some basics that even absolute beginners have to follow (posting full code examples, the use of "use strict;use warnings;"). On the other hand both languages are said to be way more elitist than PHP.

Perl's community usually meets in IRC and Usenet. The well known Perl mongers website is the central place on the web for discussing questions ranging from beginner errors to the most complex topics. Another topic discussed here are Perl games. Examples are golf, where the aim is to create a program solving a task in as few characters as possible or JAPH where people try to obfuscate a program printing the phrase "Just another perl hacker".

[edit] Links

See Also the Following Articles

Personal tools
Namespaces
Variants
Actions
Navigation
Ads
Toolbox