Python for web ?

François Pinard pinard at iro.umontreal.ca
Mon Dec 1 17:10:17 CET 2003


[Jay O'Connor]
> black wrote:

> >1. Could Python be used in web programming ? (i guess yes ?)

Yes, a lot! :-)

> >2. If the answer of above is yes, then can we programms with Python in 
> >both server and client side or either ?

I guess yes to both.  For my own usages, I use Python servers where
Python code is easily put within HTML pages.  If I really wanted to have
Python executed on the client side browsers, I would likely follow the
Jython path, as Jython is Python over Java, and some Web browsers are
already able to run Java.  (I did not really try Jython yet, however.)

> If by 'client side' you mean 'Python embedded in the HTML page' like 
> PHP, I think it's possible but I tend to avoid it.  First off, for any 
> such HTML embedded scripting you have to have a server that while parse 
> and execute the script.

If you design carefully, the overhead could be quite negligible, besides
the cycles burned by the very execution of scripts.  I would not really
see this as an impediment, in practice.

> More importantly, though, I'm not a big fan of the architecture of
> having HTML code interspersed with script coding.  I think you'd end
> up with a better software design with a normal CGI-template approach

Indeed.  Templates allow a much nicer separation of the work between
the Web designers and artists on one side, and programmers on the other
side.  Some templating systems are heavier than others (for both humans
and machines), one has to be careful when choosing or designing them.

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





More information about the Python-list mailing list