开发者

Can python modules be used from Java programs using Jython without modification?

Can Python c开发者_Go百科ode 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)?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜