Python.NET

December 30, 2007

I love Python! I love .NET! Therefore I love IronPython. It let’s you do WinForms, Speech, WPF with XAML, work with ANY .NET managed library. I am even using it to do games with XNA! And the Visual Studio integration… It gives Python programmers the tools they dream about: A debugger, intellisense and a compiler.

(I will post about my IronPython adventures in the future).

But there is just one thing that I don’t like in it. It just isn’t Python! It is the Python Language, yes, but it’s not the CPython implementation. I am now stuck with two Python Consoles and there is no way of distinguish IronPython code from regular Python. Of course IronPython is way faster, but sometimes installing it and living with two pythons isn’t always the best choice.

That’s why I really enjoyed the Python.Net. It’s a way of extending Python to access the .NET framework existent in you environment. And now they are making it compatible with IronPython code! And you can still work with all the other python modules (Not all are yet implemented in IronPython). There is only one small problem: It’s alpha software and still very unstable.

I downloaded from the trunk and compiled it with VS2005. I made the binaries available for you and should work fine in Windows XP with .NET framework 1.1, 2.0 and even 3.0 with Python 2.5 except for this bug I reported. Check the readme anyway. It’s also possible to compile to use Mono, but if you really want it, you should be able to compile it yourself ;)

Tagged with: en, python, ironpython, .net
This post has 7 comments. Feel free to read them and leave your own.
"Of course IronPython is way faster"

I find it funny when people make this kind of assertion without backing it up with some kind of evidence (even if anecdotal).

I'm made my own tests, with non-trivial code and found CPython 2.5 (on Windows) to be faster, significantly faster than IronPython (1.0 if I recall correctly).
Oh, an just another thing:

"It gives Python programmers the tools they dream about: A debugger, intellisense and a compiler."

Only people that unaware of PyDev's (http://pydev.sourceforge.net/) existence dream about this. ;)
Not that being faster is important to me, but there you go your evidence:

http://smallr.net/python-vs-ironpython
As for debugging, VisualStudio+IronPython fulfilled my needs. I've tried PyDev and Komodo (take a look at that one) but none of them convinced me. Give it a try with Visual Studio and share your opinions then.
Ok, I just checked that benchmark, and I guess I must be blind... Please confirm...

The columns are ordered "this, other, diff" with (this=ipy11.pybench, other=py25.pybench).

The average run times are "13191ms, 7741ms, +70.4%" which means "this" (IronPython) took 70% _more_ time to complete the tests than CPython. Where is IronPython "way faster" then?

But I'll concede something: benchmarks that take 12 seconds to run don't represent any real world application.

For real world code, however, there's something missing: these tests disable garbage collection, and I'm assuming that goes both for CPython and IronPython. Ok, but on real world code, memory has to be relased eventually, and CPython does it continuously (reference-counting) while IronPython/.NET does it occasionally (garbage-collection). This means that, with garbage collection active, IronPython could problably beat CPython in short-run tests just because it is doing less work in that interval.

From my tests, PyDev seems to be nice, but I won't argue on that front, because I'm a // person and only use IDEs when I _really_ have to.
Damn, that "//" got itself eaten: "text editor/cli/other tools".
buddy, I wan to call my c# methods and classes from python using python for .net. How can I do this.
Do I need to add the project dll to the search path or something else ???

Comment:

Author:
Email:
Website:
Comment:

About

I used to write in this blog, but I've found a better format to express myself. From now on, you may read my writings on ideas, programming and politics on my new wiki.

hCard

Name: Alcides Fonseca
Email:
MSN:
Gtalk:
Nov 24, 1988 40.197958, -8.408312

Tagcloud

Archives

Other links