python-ast

Python AST – merging two ASTs

Python AST – merging two ASTs Question: Do you have any idea how can i merge two asts using python ast? I would like to do something like this: n1 = ast.parse(input_a) n2 = ast.parse(input_b) n = merge(n1,n2) I would like create root n with childs n1 and n2. Thanks in advance Asked By: Kapucko …

Total answers: 1

Generate .pyc from Python AST?

Generate .pyc from Python AST? Question: How would I generate a .pyc file from a Python AST such that I could import the file from Python? I’ve used compile to create a code object, then written the co_code attribute to a file, but when I try to import the file from Python, I get an …

Total answers: 2