Iron Python : what are good uses for Iron Python [

2019-04-03 11:29发布

I have an affinity for python, but I work in a .NET environment, so I was looking into Iron Python, and wondering what it would be used for.

Could you write an app in it? or is it for adding a scripting language to your app?

How do you guys use it?

12条回答
对你真心纯属浪费
2楼-- · 2019-04-03 12:18

You can write an app in it, you can use it as a scripting language in your app.

It's used for accessing existing Python libraries and, if needed, writing parts of your code in Python if a .NET languages doesn't seem well enough suited for that job.

查看更多
甜甜的少女心
3楼-- · 2019-04-03 12:19

You use it to write Python code that runs on the .NET platform. It's good for anything that Python is good for.

The Python language is the Python language, no matter what. IronPython is an implementation of the runtime for that language - the support code that compiles your source, creates a virtual machine to execute the bytecode in the resulting .pyc file, communicates with the OS in order to put command line arguments into sys.argv, and all that other fun stuff. (Well, OK, the .NET platform itself does a lot of the work, too. :) )

查看更多
beautiful°
4楼-- · 2019-04-03 12:22

We use it as an embedded language inside of our software. I had an article on my blog, but recently switched to a new system. You can find an archived version (with broken image links) here:

Our field engineers now use the embedded language to test things on the fly, our quality assurance people use it to create small scripts to test all features of the hardware, etc....

Hope this helps.

查看更多
孤傲高冷的网名
5楼-- · 2019-04-03 12:24

You can use it for cool things like having an embedded web server within your application which can be developed with one of the available Python web frameworks. It is much easier and smoother to develop for than hosting an ASP.NET web server within your application. CherryPy for example comes with a builtin web server as well that should work fine with IronPython with a few small modifications.

查看更多
别忘想泡老子
6楼-- · 2019-04-03 12:28

First: IronPython is really more of a compiler than an interpreter in the strictest sense - it will be used to generate .NET Assemblies from your python source files. So yes, you can write apps and most anything the .NET Framework can do.

One of the largest benefits of IronPython is that it has (effectively) no GIL - meaning that if you are both writing Python code and it is multi-threaded - you can often get performance that is better than CPython without having to spawn multiple process and pickle objects across the boundaries. It doesn't solve the problem of concurrency, but .NET provides much more robust constructs for dealing with it. I think this is pretty niche honestly, but it is certainly there.

The python.org wiki page for IronPython lists a bunch of key differentiators as well:

查看更多
放我归山
7楼-- · 2019-04-03 12:32
  • IronPython is just Yet Another Python Implementation. You can use it anywhere you would use any other Python implementation. (Modulo platform constraints, of course – obviously you can't use IronPython on a Java-only device.)
  • IronPython is just Yet Another .NET Compiler. You can use it anywhere you would use any other .NET language.
  • IronPython is More Than Just Yet Another Python Implementation. It's a Python implementation that gives you full access to any .NET library.
  • IronPython is More Than Just Yet Another .NET Compiler. It's a .NET compiler that gives you full access to any Python library.
  • IronPython is an embeddable scripting engine for any .NET app, library and framework.
查看更多
登录 后发表回答