开发者

Using multiple Python versions: Can IDLE be configured to see *.py3 / *.py2

I'm new to Python, a开发者_如何转开发nd was curious about this idea. Since there are differences between Python 2.x and 3.x, could IDLE be modified (in a configuration or settings file) to recognize and compile files with a .py3 or .py2 extension? Also, is this something that would difficult to implement, or better yet, is this worth the effort to implement?


Don't know about Idle, but the preferred way to have your files determine the python version to use would be not to have different file extensions, but to use a "shebang" line, like #! /usr/bin/python3. To make this work on windows as well as linux, there is the new Python Launcher for Windows (described in pep 397)


It's not worth the effort. There are better ways to support both Python 2 and Python 3. See http://python3porting.com/, in particular http://python3porting.com/strategies.html.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜