Home Login Create account Contact Help
Close

Login to your account

Other Options

Comments feed

In response to XML or Text for Python Templates?

There are a number of (very good) templating systems and languages available for Python. They fall in to one of two camps; either they are XML based, like Genshi, or they are text based, like Mako. Most programmers favour one or the other, but there is far from a consensus over which is better.

I'd like to use this debate to gather reasons for using one over the other in the context of web development. I suspect there will be no clear winner, but it should serve as a useful resource for those faced with the decision!

...

NB. You can post code with the [code] bbcode tag. Many languages are supported. e.g.

[code python]

print "Hello, World!"

[/code] 

Simon Willison argues for "Text"
Mon, 15 Oct 2007 by simonw
Rank 1. Average +0.9 ( 7 votes )

Text-based template engines provide better performance. XML engines use an XML parser (usually a DOM based one) which can have significant overhead. Non-XML engines can be a lot faster - Django's template engine uses a single regular expression operation to toxenize a template and consistently beats XML engines in performance benchmarking.

Return to debate