• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

CPython,IronPython和Jython脚本相互兼容吗?

用户头像
it1352
帮助1

问题说明

我很确定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.

正确答案

#1

简短的答案是:有时.

基于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.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfkjjb
系列文章
更多 icon
同类精品
更多 icon
继续加载