如果我计划最终使用 Jython,我应该将 Python 代码保留在 2.x 还是迁移到 3.x?
我有一个用 Python 2.6 编写的大型基础设施,尽管缺乏向后兼容性,但我最近尝试移植到 3.1(比我预期的顺利得多)。
我最终希望将一些 Python 代码与我们拥有的大量基于 Java 的代码集成,并考虑尝试一下 Jython。然而,从 Jython 教程来看,所有示例都是 2.6 语法(例如, print 还不是函数)。
Jython 目前或不久的将来是否支持 Python 3.x 语法?或者如果我想最终使用 Jython,我应该回滚到 2.6 吗?
I have a large infrastructure that is written in Python 2.6, and I recently took a stab at porting to 3.1 (was much smoother than I expected) despite the lack of backwards compatibility.
I eventually want to integrate some of this Python code with a lot of Java based code that we have, and was thinking about giving Jython a try. However, from looking at the Jython tutorials, all the examples are in 2.6 syntax (e.g., print is not yet a function).
Does/will Jython support Python 3.x syntax at present or in the near future? Or should I roll back to 2.6 if I want to eventually use Jython?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Jython 在不久的将来将不再支持 Python 3.x。对于您的代码,我建议将其保留为 2.x 形式,这样只需运行 2to3 即可获得 3.x 支持(即无需进一步更改源代码)。 IOW,以某种方式移植到 3.x,以便代码保持与 2.x 兼容。
Jython will not support Python 3.x in the near future. For your code, I recommend to keep it in 2.x form, such that 3.x support becomes available by merely running 2to3 (i.e. with no further source changes). IOW, port to 3.x in a way so that the code remains compatible with 2.x.
我预计开发人员此时将致力于与 3.0 兼容。由于他们在 6 月发布了 2.5,我希望 3.0 版本不早于 1 月至 3 月发布。 2010 年,但鉴于其缓慢的发布周期,可能需要一段时间。
I would expect that the developers will be working towards compatability with 3.0 at this point. Since they released 2.5 in june I'd hope for a 3.0 version no earlier than Jan.-Mar. 2010, but given their slow release cycle, it could be a while.
随着时间的推移,2.x 将被 3.x 的新功能所超越。如果你将来想用 Python 编程,那么“越早越好”
With time 2.x will be surpassed by the new features of his 3.x. If you wish to programming in Python in the future then "the sooner = the better"