Getting in to metaprogramming

Michele Simionato michele.simionato at gmail.com
Tue Nov 25 06:20:06 EST 2008


On Nov 25, 12:12 pm, Rafe <rafesa... at gmail.com> wrote:
> is it really as simple as gathering strings of code?

Yes.

> Sort of like generating HTML or XML directly? Is there any other framework or
> pattern set that is worth looking in to?

Yes, the compiler module and the ast module in the standard library.
You may also
look at how templating languages that compile to Python code work (I
mean mako
or PTL/qpy). You may find interesting how the import hooks work too.




More information about the Python-list mailing list