开发者

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

开发者 https://www.devze.com 2022-12-14 22:21 出处:网络
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 looki

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.


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.

0

精彩评论

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