是否有类似于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版本,运行每个版本的脚本,看看发生了什么错误.