From kragen@dnaco.net Mon Sep  7 19:34:52 1998
Date: Mon, 7 Sep 1998 19:34:50 -0400 (EDT)
From: Kragen <kragen@dnaco.net>
To: systalk@ml.org
Subject: Re: Python and Perl
In-Reply-To: <Pine.LNX.3.96.980907115546.2403K-100000@calvin.shorelink.com>
Message-ID: <Pine.SUN.3.96.980907191841.23633X-100000@picard.dnaco.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Keywords:
X-UID: 1709
Status: O
X-Status: 

On Mon, 7 Sep 1998, George Bonser wrote:
> That was only a quick example that came off the top of my head. Look, for
> example, at PyNG. It is a python replacement for MRTG. Runs faster, takes
> less CPU and network resources. It is just more efficient.

I'll take a look at PyNG.  Thanks for the pointer.

> I am NOT saying that python is a replacement for perl though it does have
> lower overhead and run a lot faster.

I haven't tried writing programs in Python, but my impression is that
it's a really pretty language.  Perl is designed in a very unusual way,
and it doesn't have a lot of properties you normally expect a good
programming language to have; Python is much more traditional.

But Python has the advantage of having been designed just a couple of
years ago (like Perl) by one very smart fellow.

I'm curious what other advantages Python has over Perl -- other than
more traditional (modern) syntax and better speed.

> There are some cases where perl is
> best. If you are thinking awk would be a good program to use for
> something, chances are perl is better.

There are even a few tasks awk is better for.  The canonical example is
awk '{print $5}', which becomes perl -ne 'print "$F[4]\n"'.  But I
think usually you're right.

> Perl has been popularized because people started using it several years
> ago for WWW stuff and people have become exposed to it through CGI
> programming. You are now seeing more python and tcl in cgi programming so
> the kids coming along now will start learning python as it begins to
> replace perl in many applications.

Well, Perl is just incredibly convenient and easy for text processing,
as you pointed out.  Since that's what CGI scripts do (especially small
ones), Perl is the ideal language.

I think Perl is also a little older than Python, and it got established
in the sysadmin community as a nice language for doing sysadmin stuff
before the Web was very well known.

> I am not saying python is best for all things but think of it as "the next
> thing". You ARE going to start seeing it driving cgi programs (and it has
> an apache internal interpreter module just like perl does).

Yeah, definitely.  Python's got a lot going for it.

Python and Perl belong to a family of languages sometimes called
"very-high-level languages".  Other such languages might include,
depending on who you ask, Tcl, Scheme, Dylan, and Icon, as
well as several others I'm not as familiar with.  These languages are
characterized primarily by a high degree of late binding, automatic
memory management of some sort, and powerful intrinsics, usually
including things like hashing as built-in language features.

A lot of these languages are thought of as "scripting" languages, which
means you use them primarily to tie together components written in
other languages.  (That's what Tcl was designed for, in fact.)  But
they tend to outgrow that role.

Python is a shining example of how well they can do.  So is Perl.

Kragen

-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
I don't do .INI, .BAT, .DLL or .SYS files. I don't assign apps to files. I 
don't configure peripherals or networks before using them. I have a computer 
to do all that. I have a Macintosh, not a hobby. -- Fritz Anderson


