Re: Python vs. Perl vs. C++

Adrian Phillips - Tandem User (tandem@typhoon.oslo.dnmi.no)
03 May 1994 06:57:07 GMT

Okay, I know nothing about C++, but I used Perl here for a couple of
years before starting with python, which I have been using for the
last few weeks.

Firstly, using Perl 4, I found that without a lot of self discipline
the programs I was creating could become messy and not very well
structured. This is not necessarily a critisicm of Perl but my own
development techniques :-). Anyway, I have written a number of medium
sized "Perl scripts", ie. not small system management scripts but
scripts handling the switching/storing of met. messages. Now, when I
began using Python, I found myself boxing things up much better. Its
quite amazing how object-oriented porgramming makes things much more
presentable. It also amazing how fast it is to create fully functional
packages, especially once you've written a few modules (libraries)
that handle specific tasks/data. I've created modules/objects for
handling TCP/IP socket connections, serial lines, handling telex
boxes, and so on.

Take for example, a Port object for handling tcp/ip connections. I
create a new object that either connects to or accepts from a remote
socket. That object provides read/write functions, so all you need to
do then is newport.read (data), or newport.write (data). If you want
transparent data connections, ie. don't care if its serial or socket,
its great, I have the exact same read/write functions in my serial
object. Everything in Python revolves around objects (correct me if
I'nm wrong Tim :-), so instead of passing ints or char strings between
functions you can pass an object, the object can be a list, tuple,
string, numeric, or one of your home grown objects.

Okay, now Perl 5, will have/has these features but I feel that perl
scripts can become difficult for non-hackers to follow as has been
experienced here by our fortran based researchers. I had started to
look around for an alternative to Perl for larger projects which also
had X windows/Motif extensions. I've looked at Tcl/Tk but we use Motif
here and I didn't like Tcl's "everythings strings" approach. Python
was easy to pick up - it took me a just a few days to understand about
the various types, the syntax, objects, etc. It is easy to extend
using python or C objects - check out the Motif extensions - easy
stuff. As I said earlier I have only been using Python a few weeks and
I am fairly enthusiastic about it. If I get knocked down next week, I
not too worrried about somebody picking up what I've done even with
the minimal (read non-existant) documentation I've written. My python
code has plenty of comments and python is in itself so easy to
understand, my python colleague will pick it up no problem.

All this is IMHO by the way (flame insurance :-)

Adrian

--
-------------------------------------------------------------------------
= Adrian Phillips at            | BUT any thoughts in this are purely    =
= The Norwegian Meteorological  | my own and have nothing to do with     =
= Institute   	    	        | this establishment, thankfully.        =
= Net: adrian.phillips@dnmi.no  | Phone: 47 22 96 32 09 Fax: 47 22 96 30 50