Python vs. Perl, which is better to learn?

Christopher Browne cbbrowne at acm.org
Thu May 2 14:36:14 EDT 2002


Centuries ago, Nostradamus foresaw when "Steve Holden" <sholden at holdenweb.com> would write:
> "Patrick W" <quitelikely at yahoo.com.au> wrote ...
> [...]
>>
>> import IMHO and sprinkle it liberally throughout.
>>
>> A programmer ought to know at least four languages in depth. If those
>> four languages are well chosen, they can last a lifetime. If they lack
>> certain features that come pre-packaged elsewhere, it's far better to
>> acquire the _concepts_ and _techniques_ implicit in them, and
>> implement them in your chosen language(s), as opposed to madly
>> accumulating new notations simply because they possess a convenient
>> feature or two.

> So, what you seem to be saying is that I should have stuck with
> Algol 60, PLAN, PL/1 and IBM 1130 assembly language?

In a sense, yes.

The regular "sheep flight" where the sheep "nest" in one language for
a couple of years, and head on to the next as soon as it emerges as
"hot" has taken people assortedly through:

 -> BASIC
 -> FORTRAN, PL/1, COBOL
 -> Turbo Pascal
 -> C, C++, Java
 -> Ada, for some
 -> Perl, leaping to Python or Ruby or PHP
 -> xBase languages and Clipper
 -> "4GLs" like Natural, Focus, ABAP/4

And the typical result I keep seeing isthat you get people writing
crummy looking COBOL-like code in whatever language they come to.

Perl gets bashed as being "unreadable;" my opinion is that while this
_is_ a commonplace result, it comes not because Perl is inherently
horrible or unreadable, but rather because it is a place where two
"herds" have come together:

 -> On the one hand, there are some clever members of the herd that
    have great fun in using oddball idioms to build over-clever code
    that is intentionally unreadable.

 -> On the other hand, most of the "stampede" is made up of people
    that used to write bad COBOL, and have leaped over to Perl with
    the result that they write bad COBOL in Perl, achieving a sort
    of "worst of all possible worlds" (one that Pangloss wouldn't
    like).

Those two groups are far more visible than those that have the ability
and intent to write readable code.

I think we'd be better off if there hadn't been such a stampede to
create slightly distinct new languages.  Actually, that's not quite
right.  The problem isn't in the creators.  The problem is in the
"morons" that stampede to whatever is new.

I think it's fair to say that crummy Perl code is uglier and less
readable than most anything else, and that Python has some language
features that at least marginally discourage the creation of such
greatly despicable code.

Nonetheless, any language to which "morons" stampede will get
inundated with ham-handed morons.  This has the natural result that
there will be a bunch of ugly, broken, unreadable code (even in
Python).  

At some point, someone will notice this, and say "Language FOO
supports writing a lot of horrible code; I'll make something better!"
at which point something _marginally_ better in _some_ way is
developed, and if it becomes a bit popular, the morons will leap over
to it.

It's pretty ironic to point to Greenspun's principles of programming:

  "Any sufficiently complicated C or Fortran program contains an ad
  hoc informally-specified bug-ridden slow implementation of half of
  Common Lisp."  -- Philip Greenspun

  "Every sufficiently unreadable programming language contains a
  reimplementation of APL and/or INTERCAL."  -- Greenspun's Eleventh
  Rule of Programming

There was a pretty clear progression of improvements between Pascal,
Modula, Modula-2, and Modula-3; it is much less obvious that Ada is
_fundamentally_ better than, say, M3.

It's probably fair to call C++ the PL/1 of the 1990s; it is NOT
evident that it is clearly a vastly superior language to PL/1, despite
being a whole lot newer.  It's pretty funny when people point to C++
and describe it as "Simula--".  And it's also instructive that
aficionados of Algol point to it being better than most of its
successors.  That seems very likely to be true.

I think what we're mostly seeing, in the language "popularity wars,"
is the principle that
  Foo is newer, and therefore better
absent of actual evidence to support that.

People are still adding features to OSes that can be traced back to
Multics, available in the 1960s.  

I expect that someone could make a great career as a "language
designer" by simply coming out with a new language every few years
that adds in a feature or two that was in Algol that none of the other
language designers has been literate enough to have bothered noticing.

There's _some_ hyperbole in that expectation, only some.  

Just look at Ruby for a bit of an example.  One of the matters of
"significant excitement" in it is that it brings back "mixins" as an
object model.  That's something that dates back to the early days of
Common Lisp and FLAVORS.  

I would bet almost any money that someone could similarly make a
"career" of creating new languages simply by picking features out of
CLOS and using them as the basis for a "new language."
-- 
(concatenate 'string "aa454" "@freenet.carleton.ca")
http://www.cbbrowne.com/info/lsf.html
It is in the tranquillity of decomposition that I remember the long
confused emotion which was my life.



More information about the Python-list mailing list