The Case for Python


Productivity, productivity, productivity!

In general, productivity gains of 5% are considered good.   At 20-30% folks celebrate.   With Python, 300% is common.  

Not to start a religious war, but most programmers using Python experience a factor of two or three in personal productivity over Java.  Some claim more.   And most Java programmers see a factor of two in their work over C/C++.   This is made possible by Python's high level semantics, built-in data structures, and clean syntax.   Further, the language is easy to learn and its programs are easy to maintain.  

Several studies have shown the number of lines of code per day is virtually a constant regardless of language.  Thus, if an application can be correctly expressed with fewer lines of code in language A than language B, then the time to deliver is correspondingly lower.  Because Python and Perl programs are usually 1/3 to 1/6 the size of equivalent Java and C/C++ programs, delivery schedules can go accordingly. [ Ref 1 ]

Clean, Simple Syntax
Python's syntax is without clutter making the code more readable and more quickly understandable.  This makes Python easy to learn and Python applications easier to maintain.

Economy of Expression
As a VHLL, the Python syntax makes good pseudo-code.   And converting it to executable code is often trivial.   Furthermore, code running correctly the first time is a commonplace occurance.  

Consistent Semantics
Language semantics are consistent throughout.   For example, a dictionary is an in-memory indexed data structure.  If that structure needs to become file based, simply open (and close) a file, substitute that file object in lieu of the dictionary object, and the remainder the program remains unchanged.  Moving from that file based dictionary to a RDBMS is equally easy.  Create a DB object, and as before, access it with the old logic (as though it were a dictionary).  Obviously, maintainability is enhanced.

Time spent on what a program is to do is more productive than time spent on how to do it.  This results in fewer bugs....  reducing debugging time, and reducing the need for maintenance in the first place.


Backward compatability
Unlike some other well-known languages, virtually ALL of the Python programs written over the last ten years, run under the latest version of Python... unaltered!

Scalability
Python applications can start out small and as they grow, the language choice itself does not force a larger maintenance effort.

Portability
Python runs on the following platforms:

Performance
Python's runtimes reasonably quick (comparable to Perl), but if additional performance is required, consider using one or more of the following techniques. Remember too that Moore's Law is at work, continually reducing the hardware portion of TCO; a faster machine can be a cost-effective means of addressing bottlenecks.  (NB: Because people costs continue to rise, Python's programmer productivity becomes increasingly important.) 


The competition: Perl
Perl: Python:
the traditional scripting language a general purpose language
good for text manipulation uses the same regular expression syntax
good for quick, small system administration scripts as is Python
good for CGI scripts as is Python
relatively large programmer pool fastest growing programmer pool (about one million as of 9/2001)
cluttered syntax simple, clean syntax
more than one way to do it (increases maintenance complexity) one way (less to learn)
working on Java integration a mature, seamless Java interface
adding OO in version 6 built-in, not bolted on


The competition: Tcl
Tcl is string oriented; "everything is a string"

not OO

larger apps don't scale well

Tcl syntax is unusual/uncommon/strange (choose one)



The competition: VB
VB: Python:
good for COM+ integration as is Python
runs in Visual Studio as does Python
only runs on Windows Python is multi-platform
good for drag-n-drop Windows GUI development as are wxPython/Boa and KDE/KDevelop
backward compatability? not a good story virtually all Python code written over last 10 years still runs unaltered
crashes become more frequent as program size increases stability not an issue


Others:
C/C++ modules written in, or wrapped by, C/C++ can become Python extensions
Java Jython seamlessly integrates Python and Java
Lisp Python shares most features -- John Norvig: Python for Lisp Programmers


Impediments to adoption:
don't know the language
      - because it is a simple language, it is easy to learn.  Books, free tutorials, and classes are available.

no training
      - Mark Lutz and others are available to teach classes.

no vendor support
      - ActiveState and others offer support contracts.

another language will dilute the resource pool
      - it is not a hard language to learn
      - progress always requires doing something new
      - if a 300% productivity improvement is not sufficient, what is?

want to stay with the mainstream (Microsoft)
      - Python is part of .NET and ActiveState offers a Python plug-in for Visual Studio
      - the Python community is arguably the fastest growing

not strongly typed
      - actually, that is often an advantage



References:
1.  an emperical comparison of several programming languages

2.  Python Compared to Other Languages (python.org)

3.  Bruce Eckel, Thinking in Python
     Bruce Eckel, Why I Love Python