title: Is there any way to programmatically generate Python bytecode?
body: <p>I want to hack around with the Python interpreter and try creating a small DSL .  Is there any module where I can do something like this theoretical code (similar to LINQ expression trees)?  </p>
  
  <pre><code>expression_tree = Function(
      Print(
          String('Hello world!')
      )
   )
  compile_to_bytecode(expression_tree)
  </code></pre>
  
  <p>Or would it just be easier to just generate Python source code?  Could this be made easier by using C or SWIG or Cython?</p>