Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python or IronPython

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?

like image 370
johnc Avatar asked Feb 26 '09 10:02

johnc


People also ask

Is IronPython the same as 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 .

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 C# easier than Python?

In short, C# and Python are both high-level, object-oriented, and easy-to-learn languages. They ensure fast development and good performance. However, C# is more clear and organized, and it's much faster at runtime. While Python is easier to learn and write than C# and has vast standard libraries.

Can I use pandas with IronPython?

Short answer: No.


2 Answers

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.
like image 72
zweiterlinde Avatar answered Oct 20 '22 17:10

zweiterlinde


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.

like image 43
Epcylon Avatar answered Oct 20 '22 16:10

Epcylon