NEWBIE: for statement in "dive into python" gives syntax error.

John Hunter jdhunter at nitace.bsd.uchicago.edu
Tue Jul 23 20:39:28 EDT 2002


>>>>> "Mack" == Mack  <gugabbe at hotmail.com> writes:

    Mack> I started reading some tutorials on python because I've just
    Mack> read SAMS "Teach Yourself Perl in 21 days". Seems to be a
    Mack> really powerful language and looks just about what I need. I
    Mack> do not really like the complex syntax though so I thought
    Mack> that I'd look into Python as well. 

I programmed in perl for about 4 years before I started with python,
and I was skeptical (that's why I waited so long).  I figured perl did
just about everything I needed, why another scripting language?  But I
was dead wrong, and rarely work in perl anymore except to keep my old
modules plugging along.

I read Damian Conway's *Object Oriented Perl* with awe -- the man is a
perl genius.  But to make OO work in perl is labor intensive and
syntactically cumbersome.  In python, it just is.

If you have any inclinations to crunch numbers, you can write in c,
c++ or fortran, and use a host of automated tools (SWIG, boost) to
make python interfaces.  So you can code the CPU intensive parts in a
compiled language, and do the rest (dbase interface, web interaction,
distributed objects, parameter management) in python.

perl still has more comprehensive third party libraries (eg
WWW:Search) but python has libraries to do most everything you want
(eg pygoogle, who really wants to search lycos anyway).  And although
python has no equal to cpan, it has a hell of a lot more built in, so
you're more likely to be able to do what you want out of the box with
a standard python without needing to go off in search of additional
libraries.  For example, for web retrieval, python's urllib is
builtin, perl's LWP is a cpan module that has to be installed
separately (though it probably is already installed with your redhat
distro).

Stepping off of soapbox, I just wanted to catch you while you were
still young and impressionable.

Learn both if you have the time and inclination.

John Hunter



More information about the Python-list mailing list