Can Python code be used from Java using Jython, without modifying the Python code in a way which will prevent it from working correctly in CPython?
If yes, what steps would have to be taken (in the Java code)?
If not, what are the reasons that this cannot be done (so far)?
asked Feb 24, 2011 at 2:48
Abbafei
3,1463 gold badges30 silver badges25 bronze badges
1 Answer 1
- Python modules can depend on certain Python versions (e.g. Python 3 vs Python 2 and even may require a minimum Python version (e.g. 2.6) in case of using dedicated language features introduced in some Python version)
- Python modules may depend on C extensions which won't work with Jython
- Python modules may use CPython features that are not available in Jython
In general: most Python-only code should work with Jython - however like in all cases: you have to test, test, test. Good written modules provide unittests - so you should try to run the tests from Jython and see what's happening.
answered Feb 24, 2011 at 3:54
user2665694
Sign up to request clarification or add additional context in comments.
Comments
default