python vs perl lines of code

brian d foy brian.d.foy at gmail.com
Wed May 17 17:03:43 EDT 2006


In article <IRuag.28298$4L1.9158 at newssvr11.news.prodigy.com>, Edward
Elliott <nobody at 127.0.0.1> wrote:

> This is just anecdotal, but I still find it interesting.  Take it for what
> it's worth.  I'm interested in hearing others' perspectives, just please
> don't turn this into a pissing contest.
> 
> I'm in the process of converting some old perl programs to python.  These
> programs use some network code and do a lot of list/dict data processing. 
> The old ones work fine but are a pain to extend.  After two conversions,
> the python versions are noticeably shorter.

You've got some hidden assumptions in there somehere, even if you
aren't admitting them to yourself. :)

You have to note that rewriting a program, even in the same language,
tends to make it shorter, too. These things are measures of programmer
skill, not the usefulness or merit of a particular language.

Shorter doesn't really mean anything though, and line count means even
less. The number of statements or the statement density might be
slightly more meaningful. Furthermore, you can't judge a script by just
the lines you see. Count the lines of all the libraries and support
files that come into play. Even then, that's next to meaningless unless
the two things do exactly the same thing and have exactly the same
features and capabilities.

I can write a one line (or very short) program (in any language) that
does the same thing your scripts do just by hiding the good stuff in a
library. One of my friends likes to talk about his program that
implements Tetris in one statement (because he hardwired everything
into a chip). That doesn't lead us to any greater understanding of
anything though.

*** Posted via a free Usenet account from http://www.teranews.com ***



More information about the Python-list mailing list