Python CGI and Jave Server Pages (JSP)

Alex Martelli aleaxit at
Tue Aug 14 22:54:08 CEST 2001

"Maan M. Hamze" <mmhamze at> wrote in message
news:tnivoil464c658 at
> Hi to the most esteemed Python People
> I work as a programmer and we are working on a web project.  I am pushing
> for Python.  The web project calls for logging into an Oracle database,
> uploading and downloading files depending on the login information,
> processing uploaded files, and a host of million other things.  I had

If the connection to the database takes up a substantial fraction of
the CGI's working time, then a true CGI (which runs a new process
on every page-hit) may show bad performance.  However, even in
this case there are CGI-like alternatives, depending on what
webserver you're using (e.g., Xitami supports the extremely
simple and powerful LRWP protocol -- not far from a CGI except
that the same process can be reused for up to N hits at your
choice rather than for only one).

> already done the basic functionality all in CGI using Python.  Someone
> here is calling for the use of JSP.  So, the question being asked here:
> do I want to use Python and NOT JSP?  I simply can not just say:  Well, it
> is an issue of bias, and I know Python and like it, and can stand neither
> JAVA, nor JSP although I do not know anything about JSP.

You can claim that Python offers better productivity than Java.
As an authority, you could pick Bruce Eckel, best-selling author
of "Thinking in Java": his new "Thinking in Patterns" book has a
chapter on using Python *with* Java (you can freely download
the book, in the current 'beta' form, from his site on the web --
sorry, no URL at hand now), and you can download from URL you can
download his "why I love Python" presentation (as a Microsoft
Powerpoint file) where he claims 5-10 times higher productivity
for Python, and gives several good reasons why.

> Did anyone here deal with JSP in addition to Python?  If yes, how could
> convince a skeptical management to use Python and not JSP?

Maybe I could convince them to call in Eckel as a consultant to
give his advice -- he IS an authority after all:-).

> We use an IPlanet web server running on Sun Solaris by the way.

Unfortunately I know nothing about IPlanet.  Goggle searching
for 'iplanet python' gives over 2000 hits, but none of the first
few pages seem to refer to Python integration with iplanet...

However, if the _deployment_ needs to be JSP, you still
have an ace in the hole: it's called Jython.  As long as you're
running a good updated Java Virtual Machine, those .class and
.jar "100% Pure Java" files it's running *NEED NOT* have been
produced by a Java compiler.  The Jython compiler is 100%
Pure Java and a faithful implementation of Python 2.0 (2.1 is
still in alpha test for Jython, I think, so you may not want to
base a product on that).  You use exactly the same libraries as
you would in Java (plus a few from Python specifically for
Jython use -- mostly those which are coded in Pure Python,
few C-coded Python things have been ported to Java yet, I
think), so you do have to learn the libraries, but the
_language_ *IS* Python.  You'll get most of Python's advantage
in terms of programmer productivity (maybe slightly less than
5-10 times as you do have to deal with Java's slowness and
its huge rambling libraries, but surely, say, 3-4 times IS quite
achievable when the team's up to speed), and basically the
same deployment situation as with Java.

Classic Python is better than Jython in many ways (faster,
typically more up-to-date -- e.g., now CPython 2.2 is in
early alpha and Jython is in late alpha for 2.1), but Jython
has its own advantages -- chiefly deployability and access
(seamless -- you don't have to write adapters) to the huge
Java libraries and the widespread frameworks for Java.  I
would suggest that familiarity with both is a good thing...


More information about the Python-list mailing list