Idea for pure-python templates using AST.

Irmen de Jong irmen at -NOSPAM-xs4all.nl
Tue Aug 16 21:23:34 CEST 2011


On 16-08-11 13:33, Paul Wray wrote:

> The idea:
> Python syntax allows a statement to be a bare literal or identifier.
> These have no effect on the program.
>
> So the function below is legal python:
>
> def myFunc():
> 'a'
> x = 45
> 'b'; 'c'; x
>
> So is this (within the appropriate class context of course):
>
> def body(self, r):
> '<h1>'; self.heading; '</h1>'
> '<ul>'
> for itm in self.items:
> '<li>'; itm; '</li>'
> '</ul>'
>

Looks very similar to PTL what Quixote uses:
http://www.quixote.ca/overview/paper.html

(never used it though, and I doubt Quixote used ASTs)

Irmen



More information about the Python-list mailing list