[KULUA] Perl Puzzles -- a challenge for Perl mongers

Mike Coleman mkc at mathdogs.com
Tue Jun 5 03:09:47 CDT 2001


Nicholas Studt <nstudt at angrydwarf.org> writes:
> Nice puzzles. Though seeing your evangalizing of pyton I would expect 
> your time would be better spent helping them develop the language rather
> than bashing other languages.

My intent is not to bash, but rather to criticize (in the formal sense).

In my opinion, there is not nearly enough criticism and commentary about the
differences between the various programming languages.  Novices and outsiders
looking at the question of Perl vs Python might very well be left with the
impression that it's similar to the question of emacs vs vi, or even chocolate
vs strawberry.  That is, primarily a matter of taste and not substance.  I
believe that this is not the case.

I think that Python is better than Perl (for most tasks) because it has a very
clear, parsimonious, intuitive syntax and semantics, whereas Perl's is so
complex and equivocal that even experienced Perl programmers cannot correctly
divine the meaning of arbitrary snippets of Perl code.

Python also has modern programming features like OO and exceptions designed
in, not bolted on as with Perl.  Beyond that, the languages are basically
equivalent in power.  I think these are significant reasons for programmers to
use Python in preference to Perl.

> On another note, I will be rolling around laughing the first time I find /
> see / write a obfuscate python program that displays all of the problems
> that pythoners ( I don't know what you would call a bunch of python coders )
> complain about in other languages and use to claim their language as
> superior.

I'd welcome such code; Python needs criticism too to improve.  I tried to
create a few examples with my Python puzzles.  I didn't do very well, though;
probably only #5 has much chance of causing trouble in real life.  There are
some examples of obfuscated code in the Python FAQ

        http://www.python.org/doc/FAQ.html#4.15

but, notably, though they are complex, they're not particularly difficult to
parse, and I think someone with basic Python experience can describe how they
will be executed.

> My belief is not to force a rigid language down peoples throat but instead
> to fix the problem, lazy programmers, poor style, and simple stupidy.

Someone at my KCLUG talk (someone that likes Perl, I think) asked me something
like "Can't we all just get along?".  I've been thinking about that, because
I'm very sympathetic to that general idea, and it sounds reasonable on the
face of it.

My objections stem from two problems.  First, I think we do a disservice to
new programmers if we don't point them in the right direction.  If someone
says to me "I want to learn a scripting language--which should I learn
first?", my answer would be "Python or Lisp, the former being more practical
and the latter more powerful".

(I still recall, when I first got started using Unix seriously, back in 1987,
I was presented with the problem of whether to use HP's proprietary GUI
windowing system (the name of which I forget), or to use this new, not
particularly polished piece of software called 'X'.  I asked one of my more
knowledgeable peers and he replied "X is the future".  He was right, of
course, and that advice saved me a great deal of wasted time and energy.  How
useful it is to be able to see the future coming!)

Second, if we treat the languages as equivalent, to keep the peace, those who
are in a position to choose between Perl and Python for significant projects,
but who are not familiar with the actual merits of the languages (and the
general body of knowledge of our discipline) will choose Perl by default.
Why?  Because there are more Perl programmers, or at least, more programmers
who list Perl on their resumes.  This affects me because it makes it that much
harder for me to be able to choose the tool I think is the best available for
the job.

Like FORTRAN, COBOL, BASIC and Algol before, Perl has been a dramatic
contribution to our discipline.  Nothing can change that.  Now, though, I
think it's been superseded and, as far as I can see, will become a niche
language long-term.

That's my opinion.  Check it out and see what you think.

--Mike

-- 
Mike Coleman, mkc at mathdogs.com
  http://www.mathdogs.com -- problem solving, expert software development




More information about the Kclug mailing list