Should I keep my Python code at 2.x or migrate to 3.x if I plan to eventually use Jython?
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开发者_如何学Python 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?
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.
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.
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"
精彩评论