Automated code generation

Eddie Corns eddie at
Fri Sep 5 20:33:51 CEST 2003

Max M <maxm at> writes:

>Yesterday there was an article on Slashdot:

>It is about automatic code generation.

>I got interrested in the subject, did a web search, and it seems kind of 

>My main interrest is web development in Zope/CMF/Plone, where there is a 
>lot of repeated code in the products. So automated code generation seems 
>like a natural fit.

>But every time I think of a use case, I immediately think of a way to do 
>it with encapsulation instead.

>Does anybody have any experience using Python and automated code 
>generation where it actually make sense?

>Or os it useless in a language as dynamic as Python?

The target language doesn't have to be the same as the implementation
language.  A short while ago I created a small code generation program that
created snippets of C code which were woven into a hand optimised C program.
The result was an extremely fast program (which it needed to be) which still
seemed to have some capabilities of the HLL I used to create it (Scheme in
this case).  I wouldn't even have attempted doing the analysis of the user
input in C but it was so trivial in Scheme I was able to add lots of extras.
It would have been a reasonable project in Python too.  I did in fact use
Python as a front end to hide what was happening.

However I would suspect there would be a lot less scope for generating Python
code.  Its dynamic and reflexive nature make it unnecessary.


More information about the Python-list mailing list