Article of interest: Python pros/cons for the enterprise

Lou Pecora pecora at anvil.nrl.navy.mil
Fri Feb 22 10:31:57 EST 2008


In article <mailman.1065.1203610708.9267.python-list at python.org>,
 "Reedick, Andrew" <jr9445 at ATT.COM> wrote:

> 
> > -----Original Message-----
> > From: python-list-bounces+jr9445=att.com at python.org [mailto:python-
> > list-bounces+jr9445=att.com at python.org] On Behalf Of Carl Banks
> > Sent: Wednesday, February 20, 2008 8:39 PM
> > To: python-list at python.org
> > Subject: Re: Article of interest: Python pros/cons for the enterprise
> 
> > C++ is a compile-time, type-checked language, which means it is
> > totally safer for newbies than Python.  Yep, your big company is
> > totally safe with newbie C++ programmers.
> 
> Eh, don't laugh too hard.  Since Python code isn't type-checked until
> the actual code block is executed, you have to go through the extra step
> of testing/running  every  line of code before you'll find an error.
> Then there's the problem of how mutable Python objects are.  So even if
> you execute every line of code, you might not have executed the code
> with every possible type of object combination.
> 
> Compared to a statically typed language, it can get very expensive to
> write comprehensive test cases for python scripts.  So I wouldn't be
> quick to dismiss the notion that Java/C#/C++ are more newbie-safe than
> Python. =/
> 
> An amusing case in point was where I had a type-cast error in an
> exception's catch block's print statement.  This simple error caused the
> program to stop with an unhandled exception.  Something that basic would
> have been caught in a statically typed language very early in the dev
> cycle when it's cheaper to fix the problem.  And the idea of
> running/testing exceptions or simple print statements isn't always
> foremost in people's minds.  =P


Well, you're technically right about static typing. That could head off 
some bugs... But my experience over several years has been that this has 
never happened to me.  That is, where I need to test every line of code 
or even half of them.  What usually happens is that I get an error, I 
get the line and module, go there, and realize I tried to use data that 
didn't fit the expression (e.g. an object without the required method).  
Usually, a one-step fix.  What still occasionally gets me is mutable 
objects where I just use "=" to set two things (accidentally) equal to a 
mutable object instead of copying. Then modify one and get and error 
when the other object is used since they were the same object.  I know 
better, but I have a half life on this of about 4 months which means 
that about twice a year this one gets me.

Looking at it the other way having done C++ development, I am  w a y  
more productive in Python and overall spend far less time debugging.  
Just my experience.  YMMV.

-- 
-- Lou Pecora



More information about the Python-list mailing list