Promoting Python as web application development language

François Pinard pinard at iro.umontreal.ca
Fri Aug 23 09:45:03 EDT 2002


[Paul Rubin]

> I don't know about Tcl, but I think Python isn't as well-developed a
> system for web programming as Perl or PHP.

Right off the box, my feelings differ.  I found Python rather perfect for the
Web jobs we had in the recent years.  The fact is that PHP is specialised
and over-crowded with features (being ugly Perlish does not help), while
Python has been just right as it stands, no need to add that much fuss...

> The only production application shell / template system I know of is Zope,
> which is overcomplex and apparently dog slow.

There is a flurry of template systems, and I found out that it was just easy
to write one that fits us well, that was simpler than to select the best
among everything available.  One can get something astonishingly powerful
out of a little investment in energy.  Given one thinks right, of course!

> It doesn't have security features like taint checking that Perl has.

It's true that taint checking has been a nice Perl feature, for which Python
does not have a direct equivalent.  I did not even try to find one, as I
found out that with good programming habits (like resisting wild use of
`eval', `exec', `execfile', `input', `os.system' or `os.popen') and a bit
of discipline, it is hardly a problem in practice.

> Python doesn't have an SQL interface module in its standard library
> like PHP.

Having to install a third party package for SQL interface is a relative
detail.  This has not been a problem for us, and we access various databases
which do not even use the same engines.  We wrote Python modules to handle
all differences in a direction very close to the Python proposed DB API,
and this touchy apsect is now mere compactness and elegance. :-)

> The indentation syntax is nice for normal programming but it's a pain
> in the neck for template programming where you're mixing Python code
> and HTML and you more often want to jam multiple statements on a line.

We mixed Python and HTML without any kind of problem, and with happiness.
What you call "pain in the neck" has been mere "breeze and comfort" for us.
It's true that we had to ponder how to manage indentation, and it surely took
a few minutes, not much more, before we devised something reasonable! :-)

> [...] for a very long time the default behavior of cookie.py was to open a
> gaping security hole in your web site if you used it (this situation has
> recently improved due to changes in the pickle module).

Oh, I'm not aware of this one.  For other reasons, we chose to avoid
cookies and use something else for managing sessions, so I think we did
not face the problem you describe.  I guess I would not have liked it...

> If I were setting off to build a big web site today, I don't know at all
> that I'd use Python, though of course I'd want to.

For one, I would not hesitate a bit.  Yet, for some meanings of the word
"big", I guess reasonable doubts are always in order.  Our experience with
Python for Web programming has been extremely satisfying, and we got some
complex projects going with an ease and speed that is brand new for us.

In one case, switching to Python in the middle of a project (after the main
developer left the company) salvaged that project while saving us nearly
one year in development time, we evidently met the deadlines.  Moreover,
everybody is happy with the current solution, and maintenance is a breeze.

Python?  Any time! :-)

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list