如果我计划最终使用 Jython,我应该将 Python 代码保留在 2.x 还是迁移到 3.x?

发布于 2024-08-07 05:38:17 字数 256 浏览 0 评论 0原文

我有一个用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

冷情 2024-08-14 05:38:17

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.

兰花执着 2024-08-14 05:38:17

我预计开发人员此时将致力于与 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.

黯然#的苍凉 2024-08-14 05:38:17

随着时间的推移,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"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文