Python Productivity over C++

Drew Csillag drew.csillag at starmedia.net
Fri Jun 9 13:07:25 EDT 2000


On Fri, 9 Jun 2000, Steve Mullarkey wrote:

> I have been a 'C' programmer for the past 15 years and a "C++"
> programmer for the past 3 years. I'm not a genius but would modestly (?)
> class myself as reasonably competent.
> 
> In the past week I have become aware of Python. I've bought a book and
> read this newsgroup every day.
> 
> I have read in several places productivity claims of 5 to 10 times over
> 'C' and "C++". I would like to ask for some feedback from "C++"
> programmers who have moved to Python as to whether these estimates are
> realistic.
> 
> In "C++" I have :-
> 
> 1. Good tools, Borland C++ Builder, MS VC++, Memory Leak Tools,
> Profilers, Programmers Editor including Class Browser, etc..

Python's tools are very good (and don't need them a lot of the time
anyhow).  The main thing missing is a GUI builder (but glade and PyGlade
are getting there quickly).  Memory leak tools just don't apply (Python
has reference counted garbage collection).  Programmers editors are
numerous and one is included (IDLE).

> 2. I use the STL (Standard Template Library) which gives powerful string
> and container classes.

There is no STL library for Python since you don't need them, things like
mappings, lists, strings, etc. are built in.  

> 3. I use incremental compiling and linking. This reduces wait times to
> very small amounts.

Python - minimal compile time (happens automatically, so no fighting with
project defs or makefiles, dependancy tracking, etc.).
 
> 4. I can also use background compiling and linking.

C++ link time always takes forever, just sometimes forever is shorter
occasionally.  There are may stories of people starting a full compile and
going to lunch since it would be that long before the compile finished...
These stories are true (lived it myself) when dealing with a reasonably
large project.

> 5. I have 3rd party libraries to handle Regular Expressions, Date/Time,
> etc..

All available for python too (most included in the standard dist).
Python's standard library is almost a good enough reason in and of itself
to use it.  Not to mention that the language rocks.... :)

> 
> I don't want to start a flame war but, given the above, I just can't see
> where the productivity increase is generated. I am genuinely interested
> to ask "C++" programmers :-
> 
> 1. What productivity increase do you achieve ?

Better than 10x.
 
> 2. How long did you use Python before you achieved increased
> productivity ?

Well, since I was doing Python on the side, it was about a month or so.  I
was doing C++ for about 3-4 years before that.


IMNSHO, after writing Python for a month, I didn't want to do anything in
C++.  Luckily, for my current employer, I program in Python almost
exclusively (some C here and there too).  Basically, what I've discovered
is that:
    1) I write the application in Python
    2) if it's too slow, I try tweaking the slow section in python.
    3) if it's still too slow, I write a C extension.

Generally, too slow doesn't happen often and I rarely get to step 3.

My main beefs with C++ are this:
    * If you want to write dynamic programs, you spend a lot of time
      fighting the compiler, convincing it you are correct.
    * Even when not writing dynamic programs, you still spend a lot of
      time telling the compiler "I know better than you, bow to me" -- 
      by using casts.
    * C++ compilers bite when it commes to debugging templates, some are
      better than others, but they all suck.
    * Memory management sucks.  With Python, it doesn't enter the picture.
    * Can you say "buffer overflow"?
    * The language is so big that very few people know the *whole*
      language and you wind up at any job with 1 or 2 language lawyers who
      write code that nobody else understands.

Python makes all of the above much easier.

Just my $.02

Drew Csillag
--
print(lambda(q,p):'pmt:$%0.2f'%(q*p/(p-1)))((lambda(a,r,n),t:(a*r/
t,pow(1+r/t,n*12)))(map(input,('amt:','%rate:','years:')),1200.0))







More information about the Python-list mailing list