Getting in to metaprogramming

Michele Simionato michele.simionato at
Wed Nov 26 15:05:54 CET 2008

On Nov 26, 11:55 pm, "Hendrik van Rooyen" <m... at>
> Then another thing - it strikes me that any problem that can be solved
> by metaprogramming, can be solved by putting similar code into a class
> and instanciating an instance.
> Does anybody know if this is true?
> If it is, it limits the usefulness of metaprogramming to the creation
> of "stored procedures" for "later execution".
> - Hendrik

Many times (probably most times) you can avoid code generation and use
classes or
higher order functions instead. Actually I don't like code generation
in Python and other languages. I would make an exception for Lisp-like
however, since there you a pretty powerful macro mechanism that in
some cases can be
better than using higher order functions, especially if performance is
I say something more in the latest episode of my "Adventures of a
Pythonista in Schemeland"
which some of you may find interesting:

  M. Simionato

More information about the Python-list mailing list