Answer a question

I want to access some .NET assemblies written in C# from Python code.

A little research showed I have two choices:

  • IronPython with .NET interface capability/support built-in
  • Python with the Python .NET package

What are the trade-offs between both solutions?

Answers

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.

Python.NET is good if you want to just integrate one or two components from .NET into a standard python application.

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.

Logo

Python社区为您提供最前沿的新闻资讯和知识内容

更多推荐