相关疑难解决方法(0)

用于确定所需的最低版本Python的工具?

是否有类似于Pylint的内容,它将查看Python脚本(或运行它),并确定每行(或函数)需要哪个版本的Python?

例如,理论用法:

$ magic_tool <EOF
with something:
    pass
EOF
1: 'with' statement requires Python 2.6 or greater

$ magic_tool <EOF
class Something:
    @classmethod
    def blah(cls):
        pass
EOF
2: classmethod requires Python 2.2 or greater
$ magic_tool <EOF
print """Test
"""
EOF
1: Triple-quote requires Python 1.5 of later
Run Code Online (Sandbox Code Playgroud)

这样的事情可能吗?我想最简单的方法是在光盘上安装所有Python版本,运行每个版本的脚本,看看发生了什么错误.

python code-analysis

48
推荐指数
3
解决办法
2951
查看次数

标签 统计

code-analysis ×1

python ×1