Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望能够构建和修改一个ast,然后可以选择将其写为 python 字节码,以便稍后执行而无需开销。
ast
我一直在研究 and 的ast文档,但我似乎找不到任何关于此类代码最佳实践的良好资源。python3.0python2.6
python3.0
python2.6
在 python 中修改抽象语法树有哪些最佳实践和指南?
Unknown指出byteplay是此类库的一个很好的例子。
此外,本福德还引用了GeniuSQL,它使用抽象语法树将 Python 代码转换为 SQL。
除了手册和源代码之外,你自己。这个主题和 python 字节码是非常无证的。
或者,您可以尝试使用我听说过的好消息但尚未尝试过的这个 python 字节码库:
http://code.google.com/p/byteplay/
我认为geniusql正在做一些事情来将ast翻译成sql...有一个关于它的讨论但我找不到它 - 而且我无论如何都不允许链接:-(