Considering getting into Python... Any Pros-Cons?

Grant Griffin not.this at seebelow.org
Sun Nov 4 23:25:30 EST 2001


Cliff Pruitt wrote:
> 
> Hello, I've just started looking into Python and am considering delving into
> it a bit.  My main reason is that it seems to be pretty portable across
> platforms.

Perl and TCL are quite portable as well, so you might also want to
consider them.

I won't go into a comparison of Python to those except to say that
Python's major strength compared to those is its clean, simple
constructs and syntax--which make it much easier to learn, write, and
read.  Very important!

> I work on a Mac for the most part but I do work on windows
> machines durring the day and it would be fun (I think) to develop for both.
> So far I've downloaded the Python files and flipped through a little bit of
> the documentation but haven't gone into much detail with it.  I'm wondering
> if anyone could sort of give me a good idea of what Python is really capable
> of and maybe more importantly what it's NOT capable of.

If speed is a big issue, a scripting language of any kind is probably
not a good choice.  What I use Python for (and I used to use Perl for,
before I discovered Python) mostly falls into the category of "off-line
data processing", e.g. file-format conversion, extracting statistics
from data files, etc.  In those cases, speed-of-execution isn't a big
concern, yet speed-of-development _is_ a big concern.

That's the essential tradeoff: execution speed versus development
speed.  Once you get good at it, you can develop a given application in
Python faster than just about anything else (or at least that's true for
me.)

In that vein, Python is sometimes used for prototyping that you think
might eventually end up being written in a compiled language.

> The extent of my
> programming experience involves VBScript for the web.  If i had, say, a
> microsoft access Database, is python capable of displaying records and doing
> searches on that database?  Maybe more importantly is it capable of adding
> records?

Sure.  Python's has a large and useful standard library, as well as a
lot of nice third-party applications.

> Out of curiousity, what are the nicest or most complex
> applications you've seen done in Python?  A lot of what I've read referrs to
> Python as being useful as "glue" to hol dother languages like C++ and others
> together.

This is to get the best of both worlds.  Experience shows that only
certain parts of even speed-sensitive applications need to be speedy;
most of the speed (or lack thereof) is due to a small portion of the
code.  Therefore, you can code, say, 20% in C/C++ (for execution speed)
and code the remaining 80% in Python (for development speed.)

Although I think this is a good idea, I haven't personally done it, for
whatever reason.  Instead, I've typically coded speed-sensitive things
entirely in C/C++, and non-speed-senstive things entirely in Python.

> I dont know any of those so I'm wondering if Puthon will really
> be somethign useful to learn or not.

If folks in this newsgroup told you "no", they'd probably think they
were lying <wink>.

Learning Python will make you a better programmer (as learning nearly
any new language probably would).  But beyond that, I view it as a very
significant tool in my toolkit.  In fact, I think all professional
programmers should learn Python (or at least another scripting
language).  We programmers do a lot of everyday tasks that are quite
painful to program in C/C++, yet pretty easy in Python.  For example,
any form of text processing is pretty easy to whip out in Python in an
hour or so, yet the equivalent C/C++ program might take days to do.  (I
find that sort of thing to be a common task, even though my "real"
programming work is to write C/C++ for embedded systems.)

Think of Python as a screwdriver that you suddenly realize is a better
way to screw in the screws you've been hammering (with C/C++) because
you didn't know there was such a thing as a screwdriver.  That's not to
say, though, that your screwdriver is the best choice for hammering in
nails, so don't throw away your hammer.

> Your insight is greatly appreciated.

thanks-for-listening-ly y'rs

=g2
-- 
_____________________________________________________________________

Grant R. Griffin                                       g2 at dspguru.com
Publisher of dspGuru                           http://www.dspguru.com
Iowegian International Corporation            http://www.iowegian.com



More information about the Python-list mailing list