IronPython与Python .NET [英] IronPython vs. Python .NET
问题描述
我想从Python代码访问一些用C#编写的.NET程序集。
I want to access some .NET assemblies written in C# from Python code.
一些研究表明,我有两种选择:
A little research showed I have two choices:
- IronPython /支持内置
- 带有的Python href = https://github.com/pythonnet/pythonnet rel = noreferrer> Python .NET 包
- IronPython with .NET interface capability/support built-in
- Python with the Python .NET package
两种解决方案之间的权衡是什么?
What are the trade-offs between both solutions?
推荐答案
如果要主要基于.NET框架编写代码, ,我强烈建议IronPython与Python.NET。 IronPython几乎是.NET的本机-因此,与其他.NET语言集成时,它的工作非常出色。
If you want to mainly base your code on the .NET framework, I'd highly recommend IronPython vs Python.NET. IronPython is pretty much native .NET - so it just works great when integrating with other .NET langauges.
如果您只想将.NET中的一个或两个组件集成到标准python应用程序中,Python.NET就是很好的选择。
Python.NET is good if you want to just integrate one or two components from .NET into a standard python application.
使用IronPython时有明显的不同-但大多数都相当微妙。 Python.NET使用标准的CPython运行时,因此此Wiki页面是对两种实现之间差异的相关讨论。最大的差异发生在异常的代价上-因此某些标准的python库由于其实现而在IronPython中表现不佳。
There are notable differences when using IronPython - but most of them are fairly subtle. Python.NET uses the standard CPython runtime, so this Wiki page is a relevant discussion of the differences between the two implementations. The largest differences occur in the cost of exceptions - so some of the standard python libraries don't perform as well in IronPython due to their implementation.
这篇关于IronPython与Python .NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!