33

How does IronPython stack up to the default Windows implementation of Python from python.org? If I am learning Python, will I be learning a subtley different language with IronPython, and what libraries would I be doing without?

Are there, alternatively, any pros to IronPython (not including .NET IL compiled classes) that would make it more attractive an option?

7 Answers 7

33

There are a number of important differences:

  1. Interoperability with other .NET languages. You can use other .NET libraries from an IronPython application, or use IronPython from a C# application, for example. This interoperability is increasing, with a movement toward greater support for dynamic types in .NET 4.0. For a lot of detail on this, see these two presentations at PDC 2008.
  2. Better concurrency/multi-core support, due to lack of a GIL. (Note that the GIL doesn't inhibit threading on a single-core machine---it only limits performance on multi-core machines.)
  3. Limited ability to consume Python C extensions. The Ironclad project is making significant strides toward improving this---they've nearly gotten Numpy working!
  4. Less cross-platform support; basically, you've got the CLR and Mono. Mono is impressive, though, and runs on many platforms---and they've got an implementation of Silverlight, called Moonlight.
  5. Reports of improved performance, although I have not looked into this carefully.
  6. Feature lag: since CPython is the reference Python implementation, it has the "latest and greatest" Python features, whereas IronPython necessarily lags behind. Many people do not find this to be a problem.
14

There are some subtle differences in how you write your code, but the biggest difference is in the libraries you have available.

With IronPython, you have all the .Net libraries available, but at the expense of some of the "normal" python libraries that haven't been ported to the .Net VM I think.

Basically, you should expect the syntax and the idioms to be the same, but a script written for IronPython wont run if you try giving it to the "regular" Python interpreter. The other way around is probably more likely, but there too you will find differences I think.

5

Well, it's generally faster.

Can't use modules, and only has a subset of the library.

Here's a list of differences.

2
  • And there's fepy.sourceforge.net which may offer additional libraries by avoiding Microsoft licensing snafus.
    – S.Lott
    Feb 26, 2009 at 10:51
  • the link is down and the link in the comment too
    – t0b4cc0
    Dec 30, 2020 at 13:23
2

Python is Python, the only difference is that IronPython was designed to run on the CLR (.NET Framework), and as such, can inter-operate and consume .NET assemblies written in other .NET languages. So if your platform is Windows and you also use .NET or your company does then should consider IronPython.

1
  • This is more for personal edification, I do mainly work in the MS space, however that doesn't necessarily mean I should be limiting my own personal development.
    – johnc
    Feb 26, 2009 at 22:06
2

One of the pros of IronPython is that, unlike CPython, IronPython doesn't use the Global Interpreter Lock, thus making threading more effective.

In the standard Python implementation, threads grab the GIL on each object access. This limits parallel execution, which matters especially if you expect to fully utilize multiple CPUs.

2

Pro: You can run IronPython in a browser if SilverLight is installed.

0

It also depends on whether you want your code to work on Linux. Dunno if IronPython will work on anything beside windows platforms.

2
  • 1
    if it does compile to IL then mono should be able to run it!
    – Peter
    Feb 26, 2009 at 10:54
  • 1
    It runs and is available for mono.
    – Ali Afshar
    Feb 26, 2009 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.