views:

289

answers:

1

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.

+7  A: 

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.

KingRadical
Ok, I have read some posts about detecting which library you are using in python, so as long as the incompatibilities are kept to a minimum this should work out quite nicely. thanks
Charles
@Charles: Also, each of the other Python interpreters (Jython, IronPython) is going to have nice documentation detailing where it doesn't conform to CPython. If you keep an eye on those docs, you'll be able to tell quickly as soon as your extending past what works on all three.
Travis Bradshaw