Python’s Claim

Wikipedia reports about 650 programming languages. Wanting to learn basics of a new language, I chose Python. Some of its features will help me in teaching a few modelling concepts better.

Much smaller source code size – ½ to 1/10 that of other popular programming languages – is one of the claims of Python. How good is the claim?

Martin Porter’s Stemming Algorithm was published in 1979 and is used even today for Natural Language processing (NLP). The official home page for the algorithm gives its implementation in 28 different languages, of which, implementation in C, Java, and Perl are given by Martin Porter himself. Python implementation is given by Vivake Gupta.

After removing comments and blank lines, the lengths of sample code in three different languages are:

  • Python: 271 lines
  • Java:     266 lines
  • Perl:         81 lines

Python has a few lines more than Java, the language often criticized for its verbosity. Perl implementation does the magic by using regular expressions, which come naturally to Perl.

In some cases, Python code would be smaller, but the claim does not apply uniformly.

Advertisements

About pgbhat

A retired Naval Officer and an educationist. Has experience with software industry. A guest faculty at different institutes and a corporate trainer with software development companies.
This entry was posted in Technology. Bookmark the permalink.

One Response to Python’s Claim

  1. Pingback: Is RPG a “Dead Language”? – My reaction to Mel Beckman’s article at iPro and the reactions « Infosmarts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s