Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Metaprogramming is the programming language or runtime assisting with the writing or modification of your program. The classic example is runtime code generation. In Python and IronPython, this is supported through the exec statement and built-in compile/eval functions. Python source code is text, so generating code using string manipulation and then executing it is relatively easy.
But, code generation has to be relatively deterministic (your code that generates the strings is going to be following a set of rules that you determine), meaning that it’s usually easier to provide objects rather than go through the intermediate step of generating and executing code. An exception is when you generate code from user input, perhaps by translating a domain-specific language into Python. This is the approach taken by the Resolver One spreadsheet, which translates a Python-like formula language into Python expressions.