Are CPython, IronPython, Jython scripts compatible with each other?

纵然是瞬间 提交于 2019-12-22 05:04:10

问题


I am pretty sure that python scripts will work in all three, but I want to make sure. I have read here and there about editors that can write CPython, Jython, IronPython and I am hoping that I am looking to much into the distinction.

My situation is I have 3 different api's that I want to test. Each api performs the same functionality code wise, but they are different in implementation. I am writing wrappers around each language's apis. Each wrapper should expose the exact same functionality and implementation to python using Boost::python, Jython, and IronPython.

My question is, would a python script written using these exposed methods (that are common for each language) work in all three "flavors" of Python?

Like I said I am pretty sure the answer is 'Of course,' but I need to make sure before I spend too much time working on this.


回答1:


The short answer is: Sometimes.

Some projects built on top of IronPython may not work with CPython, and some CPython modules that are written in C (e.g. NumPy) will not work with IronPython.

On a similar note, while Jython implements the language specification, it has several incompatibilities with CPython (for instance, it lacks a few parts of the CPython standard library, and it can import Java standard library packages and classes, like Swing)

So, yes, as long as you avoid the incompatibilities.



来源:https://stackoverflow.com/questions/1953989/are-cpython-ironpython-jython-scripts-compatible-with-each-other

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!