Complement function of compiler.parse() in python
The compiler.parse() function in python give me the compiled code of an开发者_C百科 expression.
For ex:
compiler.parse('a/b/c')
generates
Module(None, Stmt([Discard(Div((Div((Name('a'), Name('b'))), Name('c'))))]))
How can I do the reverse of it; meaning given the compiled statement how can I get a/b/c
?
PS :: I know that compiler module is deprecated in python2.7 and python3.0 but it seems to be the only thing for my work!
uncompyle actually uncompiles 2.7 bytecode, so you might want check if you can hook into that with your parsed code after compilation.
精彩评论