Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iron Python : what are good uses for Iron Python [closed]

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?

like image 902
Master Morality Avatar asked Dec 02 '10 14:12

Master Morality


People also ask

What is IronPython used for?

IronPython works as an extension to the . NET Framework, but it can also be used by . NET projects to take advantage of Python's scripting power. Other than that, since IronPython is a real implementation of Python itself, there's no need to learn a new language or extra features if you already know Python.

Is IronPython good?

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.

What is the difference between Python and IronPython?

IronPython. Just as Jython is an implementation of Python on the JVM, IronPython is an implementation of Python on the . Net runtime, or CLR (Common Language Runtime). IronPython uses the DLR (Dynamic Language Runtime) of the CLR to allow Python programs to run with the same degree of dynamism that they do in CPython.

Does IronPython require Python?

IronPython is an open-source implementation of the Python programming language which is tightly integrated with . NET. IronPython can use . NET and Python libraries, and other .


2 Answers

Either or both :)

I wouldn't claim to know a specific "purpose" for IronPython but it certainly can be used to write applications, and it can be used for scripting within a larger .NET application.

Aside from anything else, it's a handy way of gently easing Python developers into the world of .NET. (Why not learn C# at the same time? Come on in, the water's lovely...)

like image 52
Jon Skeet Avatar answered Sep 29 '22 06:09

Jon Skeet


The biggest benefit of IronPython is that it brings the worlds of Python and .NET very close together.

If you have libraries (assemblies) written in C# you can import those directly into IronPython and use them, like this:

import clr clr.AddReferenceToFileAndPath('MyAssembly.dll')  import MyNamespace  c = MyNamespace.MyClass()  c.MyFunction() 

This is very nice for reusing exisiting .NET code when scripting or even interactive use with the IronPython interpreter.

Ordinary CPython requires Python .NET to do the same or similar things. In my experience, Python .NET works most of the time, but not always and IronPython provides a much more polished experience in accessing .NET from Python.

IronPython will probably always lag the reference implementation of CPython in terms of standard library support etc., but in general the development is not that far behind, that it would hard to work with coming from a CPython background.

Lastly, there are a few substantial differences between CPython and IronPython, to which, one should pay attention. Example - garbage collection (bit me the other day...).

like image 32
cschol Avatar answered Sep 29 '22 06:09

cschol