Python vs PHP

Cliff Wells clifford.wells at comcast.net
Fri Oct 22 17:22:53 EDT 2004


On Fri, 2004-10-22 at 21:32 +0200, JZ wrote:
> Dnia Fri, 22 Oct 2004 03:56:44 -0700, Cliff Wells napisał(a):
> 
> > I've seen nothing in the Python world that compares to Smarty templates 
> 
> I am using Smarty and I know them very well, but compiled Cheetah Templates 
> (http://www.cheetahtemplates.org) with its inheritance approach 

http://www.cheetahtemplate.org/

> is much powerfull and easier to use than Smarty. Cheetah can cache any 
> indyvidual placeholder or portions of template. Smarty caches only the 
> entire template output as a unit. Cheetah can be extended using inheritance 
> approach. Smarty can use only the containment aproach. Cheetah uses Python 
> with its all benefits. Smarty uses PHP with its messing function names, no 
> import idea, no namespaces idea, worse unicode library, no docstring, no 
> good free IDE/RAD editors etc.

First of all, more powerful wasn't the main criteria and easier to use
is arguable depending on your point of view.  Smarty strikes a fine
balance between power and simplicity.  This is where I feel most of the
Python templating engines fall down.  They try to do too much.  Smarty
appears to have found the sweet spot between simplicity and power, with
just the right type and amount of built-in utility to do its job.  On
top of that, it provides a way to extend itself with custom functions,
so the full power of PHP (broken as that may be) is within reach if you
need it.  
My personal feeling on templates is that if you find yourself needing
very powerful features, you're doing it wrong.  That's what the parent
programming language is for.  My favorite use for templates is storing
them in a database so that the end user can modify a website (via a web
interface) without knowing PHP/Python.  Were I shove too much
programming into the template, this wouldn't be possible.

Regards,
Cliff

-- 
Cliff Wells <clifford.wells at comcast.net>




More information about the Python-list mailing list