Python Productivity Gain?

Shalabh Chaturvedi shalabh at gameboard.org
Mon Feb 16 01:39:46 EST 2004


"kbass" <kbass at midsouth.rr.com> wrote in message news:<LaBXb.8774$g95.1612 at fe3.columbus.rr.com>...
> In different articles that I have read, persons have constantly eluded to
> the productivity gains of Python. One person stated that Python's
> productivity gain was 5 to 10 times over Java in some in some cases. The
> strange thing that I have noticed is that there were no examples of this
> productivity gain (i.e., projects, programs, etc.,...).  Can someone give me
> some real life examples of productivity gains using Python as opposed other
> programming languages.

There is lot that can be said about why Python is more productive.
I'll make one point that has not yet been mentioned in this thread.

I like to say that Python has a very good impedance match with the
mind (mine at least :). Normally when you program, you:

1. Analyze the problem
2. Come up with a 'solution in mind'
3. Translate the 'solution in mind' into 'solution in code'

It's 3 where Python shines. For a concrete example, consider looping
over a list of items. Apart from the looping object and the list, you
need:

Java: An iterator
C: A counter
Perl: A lot of '$' signs :)
Python: Nothing. (for item in mylist:)

Notice how Python keeps it explicit yet minimal, and there's nothing
more in your mind than what is absolutely necessary ("fits you
brain"). As a real life analogy, when I make a multi-egg omelette, for
each egg in bunch_of_eggs, I pan.put(egg.break()). If I had to think
of an iterator, or a counter, it would be lunchtime before I'd have
breakfast.

In other words, Python *is* how I think. This is what I mean by a good
impedance match.

Note that you can still use an iterator in Python (but only if and
when you need it).

For another example, consider nested lists in Perl and Python. In Perl
one struggles with the language, in Python one struggles with only the
problem.

In other languages I've used (Java, C++, Perl), I always get
sidetracked into syntax issues ("oh I have to write it *this* way!"),
library issues ("oh I have to import this and that first!") and such,
all of which consume my brainpower leaving little for the problem at
hand. These little things add up and affect productivity tremendously.
Python has few of these and I've always found myself rushing to Python
as the first choice to implement any algorithm, solution, or idea that
I had. It is the shortest path to the program.

Some newcomers are so used to thinking in roundabout ways that they
write C or Java code in Python. I did too - using counters for loops,
creating way too many classes etc. But eventually everyone learns the
power of simplicity.

Naturally, reading a Python program and figuring out what it does is
fast too, greatly improving maintainability.

I'm writing an article on Python productivity, which I'll post here at
some point.

Cheers,
Shalabh



More information about the Python-list mailing list