开发者

Complement function of compiler.parse() in python

开发者 https://www.devze.com 2023-03-12 10:02 出处:网络
The compiler.parse() function in python give me the compiled code of an开发者_C百科 expression. For ex:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消