Python vs. Perl

Roy Smith roy at panix.com
Tue May 22 22:05:10 EDT 2001


Jonathan Gardner <gardner at sounddomain.com> wrote:
> I am going to miss a lot of the C features that I live and die by (while 
> (a = getc())),

Having been a die-hard python fan for about 4 years now (and C for many 
years before that), the one thing I continually miss from C is the ability 
to write "while (x = f())".  The only way to do that in python is:

   while 1:
      x = f()
      if not x:
         break

which is pretty dumb in my book.  I've been following (not too closely) the 
evolving ideas for iterators, however, and it sure looks like that might 
solve the problem.  Being able to say:

   for x in f():

or something like that, should ease the pain a bit.

> and I am going to miss the "do this or die unless that" aspect of 
> Perl.

That translates reasonably well into a try/except block.

The biggest reasons I find python so much easier to work in compared to C 
are:

   1) dynamic memory allocation
   2) object oriented (C++ makes me barf)
   3) dynamic memory allocation
   4) slicing operators
   5) dynamic memory allocation
   6) there is no rule number 6
   7) dynamic memory allocation
   8) cool data structures like dictionaries (OK, so perl has that too).
   9) the batteries (i.e. the really cool set of standard libraries)\
   10) since it's interpreted, it's fast for prototyping.  If I'm not sure
      of something, I drop into the interpreter and "ask the computer".

The biggest reason I like python over perl is that it doesn't look like 
line noise.



More information about the Python-list mailing list