Compile AST to bytecode?

Rob De Almeida ralmeida at gmail.com
Tue Sep 19 08:19:32 EDT 2006


Hi,

I would like to compile an AST to bytecode, so I can eval it later. I
tried using parse.compileast, but it fails:

>>> import compiler, parser
>>> ast = compiler.parse("42")
>>> parser.compileast(ast)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: compilest() argument 1 must be parser.st, not instance

Any hints?

TIA,
--Rob




More information about the Python-list mailing list