Automatic Code Generation

John J. Lee jjl at pobox.com
Mon Oct 6 16:03:28 EDT 2003


Rasmus Fogh <rhf22 at mole.bio.cam.ac.uk> writes:

> On Sun, 5 Oct 2003, Ian Bicking wrote:
[...]
> > > As a general point, automtic code generation would seem like a good idea
> > > in special cases where:
[...snip code generation advantages...]
> > I would disagree that code generation is a good solution to these, or
> > nearly any case.  Specifically in Python, code generation isn't
> > necessary because you can build objects and classes dynamically.  So if
[...]
> Building the code dynamically would certainly be an alternative, so code
> generation is not necessary (i.e. unavoidable). In our case I think it
[...]

Ian was suggesting not generating code *at all*.  Just use Python's
'ordinary' dynamic features.  Paul Prescod posted some messages about
this a few years ago (claiming "code generaztion is always a hack, but
sometimes a necessary one", more or less), but I can't find the one I
was thinking of (maybe it was an article, not a USENET post?).  Here's
one from the other side of the argument, from Alex Martelli:

http://tinyurl.com/pxbr

<http://groups.google.com/groups?q=group:comp.lang.python+%22code+generation%22+hack&hl=en&lr=&ie=UTF-8&selm=Zij_8.108176%24vm5.3725547%40news2.tin.it&rnum=2>


John




More information about the Python-list mailing list