python vs perl lines of code

Edward Elliott nobody at 127.0.0.1
Sun May 21 01:06:56 CEST 2006


Larry Bates wrote:

> Sorry, I don't buy this.  I can write REALLY short programs that don't
> handle exceptions, don't provide for logging for debugging purposes, don't
> allow
> for future growth, etc.  I find that 60% of my code has nothing to do with
> the actual algorithm or function I'm trying to accomplish.  It has more to 
> do with handling user's bad input, exceptions, recovering from hardware or
> communications failures, etc.  

Wow, only 60%, I'm surprised it's that low :).  When I say the algorithms
are roughly equivalent, I'm including the amount of input verification and
error checking that they do.  To me, that's part of the algorithm.

> Inexperienced programmers can write some 
> pretty short programs that get the job done, but can't handle the real
> world.

Tell me about it.  I've taught intro comp sci, things can get real ugly real
quick. :)
 
> Also, many years ago I wrote a number of applications in APL.  We often
> referred to programs written in APL as "write only code" because going
> back
> to read what you had written after-the-fact was very hard.  You could
> write in one line of APL what takes 1000's of lines of C or even Python
> and it was pretty efficient also (for applications that needed to
> manipulate vectors or matrices).

Of course.  Comparing line counts between assembly and Prolog is pretty
useless given the vast discrepancy in their expressive power.  Perl and
Python are roughly comparable in expressiveness, so it doesn't seem
unreasonable to compare their line counts.  It might not tell you much,
there are undoubtedly better comparisons to make, but I don't think it's
grossly unfair the way you suggest.  I'm all ears if you have another
metric I can test as easily.
 
> I understand what you are trying to say, but I can't support your
> conclusions as presented.

What would those be?  I tried hard not draw any conclusions.  I just want to
see how other people's data compares to mine.

-- 
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net



More information about the Python-list mailing list