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.