pythonjython

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 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?


Solution

  • 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.