开发者

Differences between compiler and ast module in python

The compiler module has been deprecated in python 2.6. Does anybody know what is the reason behind the deprecation ? Is the ast module a direct replacement ? Will the ast modul开发者_如何学Ce be supported in python 3k ?


The compiler module was a Python compiler written in Python. It was horribly slow and a pain to maintain.

The ast module is a smarter solution to the same problem: it provides Python level access to the actual compiler used when importing modules. Since it is just a visible API for the builtin compiler, it isn't going anywhere.

ast isn't a drop-in replacement for compiler (i.e. the APIs are different), but it certainly covers many of the same use cases.


Yes, the ast module replaces the compiler module. And what do you mean by "will be supported"? Python 3 has been out for years, and of course ast is part of its standard library.

Reasons for the removal can be found here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜