Re: [SLUG] Python vs Perl

From: Ronan Heffernan (ronan.heffernan@iname.com)
Date: Fri May 11 2001 - 08:19:52 EDT


Paul M Foster wrote:

> On Thu, May 10, 2001 at 03:36:20PM -0400, edoc wrote:
>
> > Questions, please, as I kibbitz ...
> >
> > 1. Python and Perl are the only options?
> >
>
> No. Well, yes, there are a lot of other languages you could use. But few
> are as widely supported or as capable for general programming.
>
> Paul

Personally, I love Python for scripting (I am a C/C++ bigot for heavy
lifting). Python is nicely cross-platform, and object-oriented (important
for large projects, or any project that will need to change over time).
Python also has some niceties that effect performance, especially
PythonByteCode; your ASCII english-oid scripting gets parsed (once) and
stored in an unambiguous binary format the the interpreter can execute much
faster than an interpreter forced to stumble through whitespace and
comments. Admittedly, scripting languages are rarely used in
speed-sensitive tasks.

Python also works well with CORBA (a fact important to few programmers),
and (like Perl) can be embedded in HTML pages. I much prefer embedded
Python over PHP and its ilk.

I never learned Perl, so I cannot say anything comparative about it.

NEGATIVE: The most infuriating thing about Python (at least for programmers
who use "real" languages) is the indentation scheme. Any place that you
would use braces { } in C/C++ or BEGIN/END in Pascal, Python enforces
indentation. For instance, all of the statements that are part of the THEN
clause of an IF statement must be indented (identically); if its not
indented properly, then it falls outside the THEN clause:

if (os.environ["USER"] == 'john'):
   print "hello"
else:
   print "goodbye"
   sys.exit()

This is also how you define a function:

def MyFunc():
   print "starting function"
   a=a+7
   print "ending function"

print "This statement is not part of MyFunc()"

--ronan



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:55:43 EDT