CPython,IronPython和Jython脚本相互兼容吗? [英] Are CPython, IronPython, Jython scripts compatible with each other?

查看:228
本文介绍了CPython,IronPython和Jython脚本相互兼容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很确定python脚本在这三个脚本中都可以使用,但是我想确保.我在这里和那里已经读到了有关可以编写CPython,Jython,IronPython的编辑器的信息,我希望我能对此有所作为.

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.

我的情况是我要测试3种不同的api.每个api在功能上均执行相同的功能代码,但实现方式不同.我正在围绕每种语言的api编写包装器.每个包装器都应使用Boost :: python,Jython和IronPython向python提供完全相同的功能和实现.

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.

我的问题是,使用这些公开方法(每种语言通用)编写的python脚本是否可以在Python的所有三个风格"中使用?

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.

推荐答案

简短的答案是:有时.

基于IronPython构建的某些项目可能无法与CPython一起使用,并且某些用C编写的CPython模块(例如NumPy)将不适用于IronPython.

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.

类似地,尽管Jython实现了语言规范,但它与CPython有一些不兼容(例如,它缺少CPython标准库的某些部分,并且可以导入Java标准库包和类,例如Swing)

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.

这篇关于CPython,IronPython和Jython脚本相互兼容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆