[Tutor] [OT] Mono
Liam.Clarke-Hutchinson at business.govt.nz
Tue Nov 8 00:09:08 CET 2005
The main advantage of IronPython is access to the .NET framework in Python.
For most Python scripts I run, there is no speed advantage due to the
overhead of loading the framework (but then, I have an old computer.)
But, I like being able to poke .NET within a Python environment, as I didn't
want to have to learn C# to just have a play.
Because everything in .NET, whether from C# or VB.Net or C++ or IronPython,
compiles down to Intermediate Language, you've got a wide community to draw
3rd party modules from. Downside is that IL isn't that nice to try and read,
so if you didn't get the source, then it can be a bit of a black box
But yeah. I'm very impressed with what little of the .NET framework I've
seen. Avalon/WFP is the sane GUI library that Windows always needed. It's
probably a bit simpler to use than Tkinter, but seems more powerful than
wxWidgets. Of course, it's OS specific...
(I also think that once IronPython is released properly, there'll be few
reasons that pointy haired bosses could stop you using it. It's made by
Microsoft, it's .NET (is that still an 'in' buzzword?), and it all turns
into IL at the end.)
That said, the main disadvantage is that it doesn't play well with CPython
at all. The standard library is being ported across, bit by bit, but the
chances of any 3rd party module working are slim. Anything that relies on C
won't work, so it exists in great isolation from the rest of Python.
i.e. I can import the os and popen2 modules, but i can't use any variant of
popen(), as popen is built on a C function called pipe().
Also, .NET is a bit more... verbose.
Here's a comparison of CPython and IronPython creating a subprocess and
creating pipes to it.
The .NET variant allows a little more flexibility in how the process is
started (although I believe the CPython subprocess module would be a more
accurate comparison, but I can't be bothered trying to understand it's
docs), yet oddly enough has no way whereby stderr and stdout can be combined
as per popen4().
Both the below code samples perform the exact same function.
(procStdin, procStdOut, procStdErr ) =
#I think I got those around the right way. This is all from memory.
import System.Diagnostics #.NET library
process = System.Diagnostics.Process()
stInfObj = System.Diagnostics.StartInfo("c:/window/system23/cmd.exe")
stInfObj.CreateNoWindow = True
stInfObj.UseShellExecute = False
stInfObj.RedirectStandardInput = True
stInfObj.RedirectStandardOutput = True
stInfObj.RedirectStandardError = True
process.StartInfo = stInfObj
(procStdin, procStdOut, procStdErr) = (process.StandardInput,
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
Of Danny Yoo
Sent: Tuesday, 8 November 2005 8:45 a.m.
To: Matt Williams
Cc: Python Tutor
Subject: Re: [Tutor] Mono
> Slightly off topic, but could someone explain/ point me to a URL that
> explains how one might use Python with Mono (I guess it would be
> IronPython, rather than CPython), and what advantages it might give
> you (apart from a possible speed up of IronPython vs. CPython). I'm
> especially interested in the idea of being able to write different
> bits in different languages, and then run them all on Mono.
This is really specialized; I'd recommend checking with the IronPython folks
on this one.
They're pretty active; I see some familiar faces like Liam in the archives
there. *grin* I'd ask them, since they'd be most familiar with Python on
Tutor maillist - Tutor at python.org
A new monthly electronic newsletter covering all aspects of MED's work is now available. Subscribers can choose to receive news from any or all of seven categories, free of charge: Growth and Innovation, Strategic Directions, Energy and Resources, Business News, ICT, Consumer Issues and Tourism. See http://news.business.govt.nz for more details.
http://www.govt.nz - connecting you to New Zealand central & local government services
Any opinions expressed in this message are not necessarily those of the Ministry of Economic Development. This message and any files transmitted with it are confidential and solely for the use of the intended recipient. If you are not the intended recipient or the person responsible for delivery to the intended recipient, be advised that you have received this message in error and that any use is strictly prohibited. Please contact the sender and delete the message and any attachment from your computer.
More information about the Tutor