[python-uk] Python Programming on Win32

Duncan Booth duncan.booth at suttoncourtenay.org.uk
Thu Mar 4 04:29:21 EST 2004

> If you are looking at using Python with .NET then look at Mark Hammond's
> website (http://starship.python.net/crew/mhammond/) as he has some stuff
> about it... as he was involved in a prototype of a Python -> .NET compiler.
> Also have a search for Python.NET (http://zope.org/Members/Brian/PythonNet/)
> as some of the .NET functionality is available in this.

That prototype only runs on the Beta prior to the first release of 
.Net 1.0, it takes quite a bit of work just to get it to run on the 
released .Net. I know, because I've got a version which does run, 
although it has migrated some distance from Mark Hammond's. You only 
get a subset of Python functionality, and pystone runs about 20-25 
times slower on the Mark's version and a bit faster on mine. Jim 
Hugunin has a version which allegedly runs some benchmarks faster 
than C Python, but I wouldn't hold my breath for any of these 
versions to see the light of day.

Python.Net makes .Net classes available to the standard Python 2.3 
interpreter. This means that you have a full standard Python, *and* 
you can use most of .Net. The main drawback though is that any call 
to .Net is *slow*. I tried a simple program that filled a dictionary 
with strings, or filled a .Net hashtable with the same strings. The 
calls to .Net worked out slower by a factor of 100. So, if you want 
to use this, try to keep tight loops either entirely in Python or 
entirely in .Net, don't cross the bridge too often.

Duncan Booth              
duncan.booth at suttoncourtenay.org.uk
month=lambda p:ord("\5\10\3\6\7\13\1\11\12\2\0\4"[124864/
((sum([s*ord(c)for(c,s)in zip(p,(1,1,-1))])&31)+1)%12])
# Who said my code was obscure?

More information about the python-uk mailing list