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?
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.
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. :) )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.
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.
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: