Getting in to metaprogramming

Michele Simionato michele.simionato at gmail.com
Thu Nov 27 08:41:54 EST 2008


On Nov 27, 5:41 am, "Hendrik van Rooyen" <m... at microcorp.co.za> wrote:
> Given that, can anybody think of an example that you could not do with
> a class?  (excepting the "stored procedure" aspect)

The namedtuple recipe by Raymond Hettinger (http://
code.activestate.com/recipes/500261)
is an interesting example of code generation. My own decorator module
use a similar
trick. Here code generation (plus eval/exec) is needed since you need
control on
the signature of a function. If we could change the signature of a
function (I think
this is possible in Python 3.0, I have to check) then we would not
need code
generation.



More information about the Python-list mailing list