By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,345 Members | 1,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,345 IT Pros & Developers. It's quick & easy.

Python for .NET and IronPython

P: n/a
Hi all. I'm currently learning C#, and I'm also interested in learning
Python (all of this just for fun, mind you), so it seems like a decent
idea to want to integrate the two. But I don't quite understand the
difference between these two Python implementations and I was hoping
someone could explain.

Does either one require learning something different than the core
Python language? With IronPython, would you actually be writing .NET
code? I know Python for .NET is treated as a true language in the CLR,
but I don't quite grasp what all this means for each language, and what
the learning process for either language would be like as a result.

Thanks,
John
Nov 2 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
John Salerno wrote:
code? I know Python for .NET is treated as a true language in the CLR,
but I don't quite grasp what all this means for each language


isn't* treated, I meant to say!
Nov 2 '05 #2

P: n/a
I was under the impression that IronPython is like CPython and Jython,
namely an implementation of the Python language. So in that sense it is
exactly like normal Python, although I don't know how convenient it is
to deploy.

I was also under the impression that Python for .NET is like an API
wrapper thingy, analagous to the win32com package that wraps that
interface and allows you to call functions and stuff provided by the
..NET API. It is not at all an implementation of Python.

I am confident that we will learn shortly whether I'm wrong.

Nov 2 '05 #3

P: n/a
For more information on Iron Python see http://www.ironpython.com/
My take on Iron Python is the new job the develolper of Iron Python
started last year takes up just about all of his time and the developer
is currently spending very little time actively developing Iron Python.
I suspect it will be a long time before Iron Python will be a main
stream product. Hence I suggest you spend your time learning Python and
C# and you forget about Iron Python until it is more fully developed.
Howard
John Salerno wrote:
Hi all. I'm currently learning C#, and I'm also interested in learning
Python (all of this just for fun, mind you), so it seems like a decent
idea to want to integrate the two. But I don't quite understand the
difference between these two Python implementations and I was hoping
someone could explain.

Does either one require learning something different than the core
Python language? With IronPython, would you actually be writing .NET
code? I know Python for .NET is treated as a true language in the CLR,
but I don't quite grasp what all this means for each language, and what
the learning process for either language would be like as a result.

Thanks,
John


Nov 3 '05 #4

P: n/a
IronPython is good if you want to bring in Python into a .NET world.

Python for .NET is good if you want to bring in .NET into a Python
world.

As for your learning concerns, there need be none. There is really
nothing to learn extra for the integration. They just work. Once you
learn the .NET framework and Python, there isn't much to know
additionally.

While you are on topic, check out Boo. It is not the same as the ones
you mentioned but you might find it interesting and useful while
working with .NET if you have Python tastes.

Nov 3 '05 #5

P: n/a

hrh1818 wrote:
For more information on Iron Python see http://www.ironpython.com/
My take on Iron Python is the new job the develolper of Iron Python
started last year takes up just about all of his time and the developer
is currently spending very little time actively developing Iron Python.


Actually, he just stopped updating ironpython.com (a bad idea, imo)
apparently.

Last release was 10/13 through Microsoft,
http://www.microsoft.com/downloads/d...DisplayLang=en

If that link doesn't work you can just search "IronPython" on
microsoft.com

Brett

Nov 3 '05 #6

P: n/a
hrh1818 <ho******@westerncom.net> wrote:
For more information on Iron Python see http://www.ironpython.com/
My take on Iron Python is the new job the develolper of Iron Python
started last year takes up just about all of his time and the developer
is currently spending very little time actively developing Iron Python.
I suspect it will be a long time before Iron Python will be a main
stream product. Hence I suggest you spend your time learning Python and
C# and you forget about Iron Python until it is more fully developed.


According to the guy who came present IronPython at EURO OScon, there's
now 1.5 people (both MS employees) working on IronPython -- the
presenter himself, fulltime, and Jim Hugunin, halftime. The language is
just about ready (with a few last decisions to make, such as, stick to
unicode-only strings like Jython, or strive for greater practical
compatibility with current CPython?); it passes the CPython unit-tests,
with a few adjustments needed where the tests overspecify some aspects
of behavior compared to the Language Manual.

What's missing is a lot of the Python standard library -- most of the
parts that are written in C in CPython (and, I believe, in Java in
Jython). My impression is that the realistic timeframe to implement
those is several months; meanwhile, IronPython is usable if you're
willing to make direct calls to the standard MSCLR libraries (i.e.,
forego ease of future moves to CPython).

A beginner might be best advised to stick with CPython (and, if DotNet
is needed, perhaps the Python-like language Boo) while IronPython
stabilizes and fleshes out, but I'm rather more optimistic than you
about the speed with which that will happen.
Alex
Nov 3 '05 #7

P: n/a

John Salerno wrote:
Hi all. I'm currently learning C#, and I'm also interested in learning
Python
In a similar position to yourself - learning both languages - I can
definitely recommend Python ( though C# 's curly brackets might annoy
you more than they did before!!)
so it seems like a decent
idea to want to integrate the two


FWIW, what I've been doing lately is calling Python scripts from
Windows.Forms apps, capturing their 'StdOut'. There's an article on
http://www.thecodeproject.com which explains how you can do this
asynchronously, but the following (C#) code is what I'm using ( imagine
a Windows Form with a TextBox to enter the script name, another to
enter any arguments for the script, and 'Run', 'Cancel' and 'Browse'
CommandButtons).
(assumes the script requires no user interaction)

private void BrowseForScript_Click(object sender, System.EventArgs e)
{
if ( this.openFileDialog.ShowDialog() == DialogResult.OK )
{
this.txtIO.Clear();
this.txtIO.Focus();
this.txtIO.AppendText( openFileDialog.FileName);
}
}

private void Run_Click(object sender, System.EventArgs e)
{
System.Diagnostics.ProcessStartInfo startInfo;
System.Diagnostics.Process process;
string directory;
string pyArgs;
string script;

script = this.txtIO.Text.Trim();

if ( script == null || script.Length == 0 )
{
return;
}

try
{
directory = Path.GetDirectoryName( script );
script = Path.GetFileName( script );
}
catch (ArgumentException)
{
MessageBox.Show("The script file path contains invalid characters.",
"Invalid Script Path",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}

if ( script.Length == 0 )
{
MessageBox.Show("No script file has been specified.",
"Invalid Script Path",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}

if ( directory == null || directory.Length == 0 )
{
directory = DEFAULT_SCRIPT_DIRECTORY;
}

pyArgs = this.txtArgs.Text.Trim();

startInfo = new ProcessStartInfo("python");
startInfo.WorkingDirectory = directory;
startInfo.Arguments = script + " " + pyArgs;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;

process = new Process();
process.StartInfo = startInfo;
process.Start();

string s;
while ((s = process.StandardOutput.ReadLine()) != null)
{
this.__application.Write( s + "\n" );
}

while ((s = process.StandardError.ReadLine()) != null)
{
this.__application.Write( s + "\n" );
}
}
Gerard

Nov 3 '05 #8

P: n/a
I just want to clarify that the above mentioned web site
(www.ironpython.com) is no longer maintained.
If you want to get updated information on IronPython, you should visit
this site:
www.gotdotnet.com/Workspaces/Workspace.
aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742

Or the mailing list here:
http://lists.ironpython.com/pipermai...ronpython.com/

By the way, the current version is 0.9.3 and it's advancing at a pretty
fast pace towards version 1.0.

Luis

Nov 3 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.