Python vs. Perl

Martijn Faassen m.faassen at vet.uu.nl
Tue May 22 20:34:35 EDT 2001


Jonathan Gardner <gardner at sounddomain.com> wrote:
> I like the simplicity of everything - the way 
> almost anyone can understand it. (Is this a feature or a bug?)

A feature of course! What motivates you to ask this question in the
first place? Are you seriously asking this question? If so, I'm genuinely
curious about your motivations.

> It doesn't seem good enough to convince me to get knee deep, however. I am 
> going to miss a lot of the C features that I live and die by (while (a = 
> getc())),

In Python, you're going to have to live without this one. There are 
decent alternatives, from:

while 1:
   a = getc()
   if not a:
       break
   ...

to the use of specialized methods (xreadlines() for instance) and iterators,
for many common usages.
 
> and I am going to miss the "do this or die unless that" aspect of 
> Perl.

I'm not well versed enough in Perl to know what the advantages of this
could possibly be. What's wrong with using 'if' and exceptions?
Uncaught exceptions cause the program to abort (with a nice traceback).
The neat thing about exceptions is that you can actually catch them
as well, if you expect their occurance.
   
> What does Python have that makes it so great?

You named some of the things yourself; very clear syntax and semantics,
simple but powerful object orientedness. I'd list the flexibility,
the extensibility and the user community as well.

> Why should I spend time 
> to become intimate with it? I am looking for comments from people that 
> actually have used Perl or C/C++ extensively, and I am looking for comments 
> that go beyond the FAQ.

I'm only well versed in C and C++. Compared to C++, simplicity and
dynamic typing. Also an absence of things like segfaults. Compared to C,
object orientedness and high level data structures.

There are a ton of small details that make Python very nice to use.
Take the recent thread about how ranges work in Python, for instance.
It turns out that i:j meaning from index i up to but not including j
avoids many off-by-one errors (on say indexes point before the elements,
not at them). The 'just enough syntactic sugar but not too much'
thing.

Finally, you should know there are very powerful organisations like
the Python Secret Underground (PSU) promoting Python. You'd better not
cross them or you'll be in huge trouble. Believe me, I've experienced
it myself. :)

I-wrote-something-very-funny-but-they-censored-it-ly yours,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list