From korpse-ironpython at kaydash.za.net Fri Jul 1 21:42:34 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Fri, 1 Jul 2005 21:42:34 +0200 Subject: [IronPython] ReflectedPackage issue Message-ID: <20050701194222.989A5AB40@ctb-mesg4.saix.net> Hi, I'd like to start off by saying that I'm not sure whether this is the preferred place to post patches. If not, you may want to start writing your reply now. Recently IronPython sparked my interest in using DirectX from Python, however I've run into a couple of issues. One of which I've been able to fix...as far as I can tell anyway. Here is a demonstration of the problem: IronPython 0.7.6 on .NET 2.0.50215.44 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys >>> sys.LoadAssemblyByName('System') >>> sys.LoadAssemblyByName('Microsoft.DirectX') >>> import System, Microsoft.DirectX >>> Microsoft.DirectX.Matrix >>> Microsoft.DirectX.UnsafeNativeMethods.Matrix Hrm...that's not right. This matters because Microsoft.DirectX.Matrix provides more functionality than Microsoft.DirectX.UnsafeNativeMethods.Matrix; this problem actually crops up with a number of other objects in the Microsoft.DirectX namespace, namely Vector3, Quaternion, etc. So, I went investigating... >>> A = System.Reflection.Assembly.LoadWithPartialName('Microsoft.DirectX') >>> M1, M2 = [t for t in A.GetExportedTypes() if >>> t.FullName.endswith('Matrix')] >>> M1 Microsoft.DirectX.Matrix >>> M2 Microsoft.DirectX.UnsafeNativeMethods+Matrix >>> M1.Name 'Matrix' >>> M2.Name 'Matrix' >>> M1.FullName 'Microsoft.DirectX.Matrix' >>> M2.FullName 'Microsoft.DirectX.UnsafeNativeMethods+Matrix' Logically enough, Microsoft.DirectX.Matrix and Microsoft.DirectX.UnsafeNativeMethods.Matrix both report their name as "Matrix" but not their full name. Following the codepath lead me to IronPython.Objects.ReflectedPackage, where I found the problem: GetCoreTypeName. It returns, for all intents and purposes, the type's Name property, which the calling functions then use as a key to map the type to. Of course, this causes a problem when two objects have the same name, which would explain the craziness, after calming down, I was seeing. I've attached a patch that appears to fix the problem. For interest's sake, after applying my patch: IronPython 0.7.6 on .NET 2.0.50215.44 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys >>> sys.LoadAssemblyByName('System') >>> sys.LoadAssemblyByName('Microsoft.DirectX') >>> import System, Microsoft.DirectX >>> Microsoft.DirectX.Matrix >>> Microsoft.DirectX.UnsafeNativeMethods.Matrix I'm not sure if I've fixed this The Right Way, but I've attached my patch anyway. -- Jonathan -------------- next part -------------- A non-text attachment was scrubbed... Name: namespace-collisions.patch Type: application/octet-stream Size: 898 bytes Desc: not available URL: From kfarmer at thuban.org Fri Jul 1 23:04:59 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Fri, 1 Jul 2005 14:04:59 -0700 Subject: [IronPython] "CLR Dynamic languages under the hood" Message-ID: Good intro to implementation details for dynamic languages under the CLR, from Joel Pobar's blog: http://blogs.msdn.com/joelpob/archive/2005/07/01/434728.aspx From mailinglist.account at gmail.com Sat Jul 2 01:19:34 2005 From: mailinglist.account at gmail.com (Anthony Tarlano) Date: Sat, 2 Jul 2005 01:19:34 +0200 Subject: [IronPython] ReflectedPackage issue In-Reply-To: <20050701194222.989A5AB40@ctb-mesg4.saix.net> References: <20050701194222.989A5AB40@ctb-mesg4.saix.net> Message-ID: Great job! this is why open source succeeds... Let's hope that the ironPython team accepts your efforts. Anthony On 7/1/05, Jonathan Jacobs wrote: > > Hi, > > I'd like to start off by saying that I'm not sure whether this is the > preferred place to post patches. If not, you may want to start writing > your > reply now. > > Recently IronPython sparked my interest in using DirectX from Python, > however I've run into a couple of issues. One of which I've been able to > fix...as far as I can tell anyway. > > Here is a demonstration of the problem: > > IronPython 0.7.6 on .NET 2.0.50215.44 > Copyright (c) Microsoft Corporation. All rights reserved. > >>> import sys > >>> sys.LoadAssemblyByName('System') > >>> sys.LoadAssemblyByName('Microsoft.DirectX') > >>> import System, Microsoft.DirectX > >>> Microsoft.DirectX.Matrix > > >>> Microsoft.DirectX.UnsafeNativeMethods.Matrix > > > Hrm...that's not right. This matters because Microsoft.DirectX.Matrix > provides more functionality than > Microsoft.DirectX.UnsafeNativeMethods.Matrix; this problem actually crops > up > with a number of other objects in the Microsoft.DirectX namespace, namely > Vector3, Quaternion, etc. > > So, I went investigating... > > >>> A = System.Reflection.Assembly.LoadWithPartialName('Microsoft.DirectX > ') > >>> M1, M2 = [t for t in A.GetExportedTypes() if > >>> t.FullName.endswith('Matrix')] > >>> M1 > Microsoft.DirectX.Matrix > >>> M2 > Microsoft.DirectX.UnsafeNativeMethods+Matrix > >>> M1.Name > 'Matrix' > >>> M2.Name > 'Matrix' > >>> M1.FullName > 'Microsoft.DirectX.Matrix' > >>> M2.FullName > 'Microsoft.DirectX.UnsafeNativeMethods+Matrix' > > Logically enough, Microsoft.DirectX.Matrix and > Microsoft.DirectX.UnsafeNativeMethods.Matrix both report their name as > "Matrix" > but not their full name. > > Following the codepath lead me to IronPython.Objects.ReflectedPackage, > where > I found the problem: GetCoreTypeName. It returns, for all intents and > purposes, the type's Name property, which the calling functions then use > as > a key to map the type to. > > Of course, this causes a problem when two objects have the same name, > which > would explain the craziness, after calming down, I was seeing. I've > attached > a patch that appears to fix the problem. > > For interest's sake, after applying my patch: > > IronPython 0.7.6 on .NET 2.0.50215.44 > Copyright (c) Microsoft Corporation. All rights reserved. > >>> import sys > >>> sys.LoadAssemblyByName('System') > >>> sys.LoadAssemblyByName('Microsoft.DirectX') > >>> import System, Microsoft.DirectX > >>> Microsoft.DirectX.Matrix > > >>> Microsoft.DirectX.UnsafeNativeMethods.Matrix > > > I'm not sure if I've fixed this The Right Way, but I've attached my patch > anyway. > -- > Jonathan > > > _______________________________________________ > users-ironpython.com mailing list > users-ironpython.com at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From martmaly at exchange.microsoft.com Sat Jul 2 18:18:47 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Sat, 2 Jul 2005 09:18:47 -0700 Subject: [IronPython] bug? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE368AFC@DF-BANDIT-MSG.exchange.corp.microsoft.com> Thanks for the report, Louis; It is most likely an IronPython bug. I am going to look into this. Martin ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Luis M. Gonzalez Sent: Thursday, June 30, 2005 2:25 PM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] bug? Hi all, I post this here because I don't know how to describe it in the bug tracker. This simple code reads a text file and removes all the dots, parenthesis and signs from each word, which then is printed in the screen: >>> f = open('c:/documents and settings/usuario1/escritorio/sw3.txt') >>> for line in f: for word in line.split(): st=[] for i in word: if i not in ['.','(',')','?']: st.append(i) print ''.join(st) It works in Cpython, but in Ironpython it just prints empty spaces intead of words. Any hint? Regards, Luis -------------- next part -------------- An HTML attachment was scrubbed... URL: From freddiewitherden at hotmail.com Fri Jul 1 16:57:03 2005 From: freddiewitherden at hotmail.com (Freddie Witherden) Date: Fri, 01 Jul 2005 14:57:03 +0000 Subject: [IronPython] Documentation Message-ID: Hi, I would like to know if there is currently any form of documentation project running for IronPython. As, while I am very fond of it there are a few things that do need to be documented, eg import sys sys.LoadAssemblyByName() As LoadAssemblyByName is not a standard method of the sys object. It would be nice to have some information on windows forms which are also a 'special' feature of IronPython. From shidan at gmail.com Mon Jul 4 09:53:02 2005 From: shidan at gmail.com (Shidan) Date: Mon, 4 Jul 2005 03:53:02 -0400 Subject: [IronPython] Error Message Message-ID: <429b380e05070400535fa7372d@mail.gmail.com> Hi I'm getting the following message, couldn't find anything similar on the bug tracker: C:\MontLingua\python>ironpythonconsole MontyLingua.py IronPython.Objects.PythonNameError: name 'self' not defined at __main__.MontyLingua$maker0() in C:\MontLingua\python\MontyLingua.py:line 241 at __main__.Initialize() in C:\MontLingua\python\MontyLingua.py:line 157 ### This is the code : def split_paragraphs(self,text): """inputs a raw text and outputs a list of paragraph segments""" return self.theMontyTokenizer.split_paragraphs(text) ##this is line 241 Am I doing something wrong or is this a bug Another message I can't figure out is the following: C:\MontLingua\python>ironpythonconsole MontyLingua.py IronPython.Objects.PythonSyntaxError: unexpected token at MontyLingua.p y:268 ### Heres the code: def strip_tags(self,tagged_or_chunked_text): toks = tagged_or_chunked_text.split() toks = filter(lambda x:'/' in x,toks) toks = map(lambda x:x.split('/')[0],toks) ### Line 268 return ' '.join(toks) Looking forward to learning more about IronPython so thanks in advance. ----- Shidan From wilberforce at gmail.com Mon Jul 4 10:17:14 2005 From: wilberforce at gmail.com (xtian) Date: Mon, 4 Jul 2005 09:17:14 +0100 Subject: [IronPython] Error Message In-Reply-To: <429b380e05070400535fa7372d@mail.gmail.com> References: <429b380e05070400535fa7372d@mail.gmail.com> Message-ID: <8a420c0705070401177dd79fd7@mail.gmail.com> It sounds like both problems are space/tab indenting problems - the first because line 241 is interpreted as at the block/level of the class, rather than the method, and the second because the code at line 268 is indented further than the preceding line. Try turning on visible whitespace in your editor, and make sure you're not mixing tabs and spaces. CPython interprets a tab as 8 spaces, and I'd guess that IronPython does the same. If the editor you're using interprets them differently (say by advancing to the next tab-stop), you'll get code that looks right in the editor, but has errors like this. Configure your editor to insert when you hit tab. I tell Textpad to insert tabs, but convert all tabs in the file to 4 spaces on saving. This has the advantage of not having to delete them one-by-one on an unindent, although you can generally use shift-tab (or ctrl-[ in IDLE) for that anyway. (Some people would say that you should only use tabs. But I think they're dying out - selection pressures seem to favour big, burly backspace-key-fingers. ;) Are you already familiar with CPython? It might be good to have a play with that as well, if you're not - that could help you to work out whether you're seeing a bug, or standard Python behaviour. Hope that helps! xtian On 7/4/05, Shidan wrote: > Hi I'm getting the following message, couldn't find anything similar > on the bug tracker: > > C:\MontLingua\python>ironpythonconsole MontyLingua.py > IronPython.Objects.PythonNameError: name 'self' not defined > > at __main__.MontyLingua$maker0() in C:\MontLingua\python\MontyLingua.py:line 241 > > at __main__.Initialize() in C:\MontLingua\python\MontyLingua.py:line 157 > > ### This is the code : > def split_paragraphs(self,text): > """inputs a raw text and outputs a list of paragraph segments""" > return self.theMontyTokenizer.split_paragraphs(text) > ##this is line 241 > > > Am I doing something wrong or is this a bug > > > Another message I can't figure out is the following: > > C:\MontLingua\python>ironpythonconsole MontyLingua.py > IronPython.Objects.PythonSyntaxError: unexpected token at > MontyLingua.p > y:268 > > ### Heres the code: > > def strip_tags(self,tagged_or_chunked_text): > toks = tagged_or_chunked_text.split() > toks = filter(lambda x:'/' in x,toks) > toks = map(lambda x:x.split('/')[0],toks) ### Line 268 > return ' '.join(toks) > > > Looking forward to learning more about IronPython so thanks in advance. > > ----- > Shidan > _______________________________________________ > users-ironpython.com mailing list > users-ironpython.com at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From kveretennicov at gmail.com Mon Jul 4 10:25:59 2005 From: kveretennicov at gmail.com (Konstantin Veretennicov) Date: Mon, 4 Jul 2005 11:25:59 +0300 Subject: [IronPython] Error Message In-Reply-To: <429b380e05070400535fa7372d@mail.gmail.com> References: <429b380e05070400535fa7372d@mail.gmail.com> Message-ID: <4660fe3005070401252552a046@mail.gmail.com> On 7/4/05, Shidan wrote: > Another message I can't figure out is the following: > > C:\MontLingua\python>ironpythonconsole MontyLingua.py > IronPython.Objects.PythonSyntaxError: unexpected token at > MontyLingua.p > y:268 There is a script in CPython distribution called reindent.py. You may find it useful. - kv From shidan at gmail.com Mon Jul 4 10:34:35 2005 From: shidan at gmail.com (Shidan) Date: Mon, 4 Jul 2005 04:34:35 -0400 Subject: [IronPython] Error Message In-Reply-To: <8a420c0705070401177dd79fd7@mail.gmail.com> References: <429b380e05070400535fa7372d@mail.gmail.com> <8a420c0705070401177dd79fd7@mail.gmail.com> Message-ID: <429b380e0507040134330616f9@mail.gmail.com> Thanks xtian I thought that might be the problem as well, but the program runs fine in both CPython and Jython. I played around with the indenting for both snippets to no avail. Any more pointers? ---- Shidan On 7/4/05, xtian wrote: > It sounds like both problems are space/tab indenting problems - the > first because line 241 is interpreted as at the block/level of the > class, rather than the method, and the second because the code at line > 268 is indented further than the preceding line. > > Try turning on visible whitespace in your editor, and make sure you're > not mixing tabs and spaces. CPython interprets a tab as 8 spaces, and > I'd guess that IronPython does the same. If the editor you're using > interprets them differently (say by advancing to the next tab-stop), > you'll get code that looks right in the editor, but has errors like > this. > > Configure your editor to insert indent level (2, 3 or 4 seem popular)> when you hit tab. I tell > Textpad to insert tabs, but convert all tabs in the file to 4 spaces > on saving. This has the advantage of not having to delete them > one-by-one on an unindent, although you can generally use shift-tab > (or ctrl-[ in IDLE) for that anyway. > > (Some people would say that you should only use tabs. But I think > they're dying out - selection pressures seem to favour big, burly > backspace-key-fingers. ;) > > Are you already familiar with CPython? It might be good to have a play > with that as well, if you're not - that could help you to work out > whether you're seeing a bug, or standard Python behaviour. > > Hope that helps! > xtian > > On 7/4/05, Shidan wrote: > > Hi I'm getting the following message, couldn't find anything similar > > on the bug tracker: > > > > C:\MontLingua\python>ironpythonconsole MontyLingua.py > > IronPython.Objects.PythonNameError: name 'self' not defined > > > > at __main__.MontyLingua$maker0() in C:\MontLingua\python\MontyLingua.py:line 241 > > > > at __main__.Initialize() in C:\MontLingua\python\MontyLingua.py:line 157 > > > > ### This is the code : > > def split_paragraphs(self,text): > > """inputs a raw text and outputs a list of paragraph segments""" > > return self.theMontyTokenizer.split_paragraphs(text) > > ##this is line 241 > > > > > > Am I doing something wrong or is this a bug > > > > > > Another message I can't figure out is the following: > > > > C:\MontLingua\python>ironpythonconsole MontyLingua.py > > IronPython.Objects.PythonSyntaxError: unexpected token at > > MontyLingua.p > > y:268 > > > > ### Heres the code: > > > > def strip_tags(self,tagged_or_chunked_text): > > toks = tagged_or_chunked_text.split() > > toks = filter(lambda x:'/' in x,toks) > > toks = map(lambda x:x.split('/')[0],toks) ### Line 268 > > return ' '.join(toks) > > > > > > Looking forward to learning more about IronPython so thanks in advance. > > > > ----- > > Shidan > > _______________________________________________ > > users-ironpython.com mailing list > > users-ironpython.com at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > From wilberforce at gmail.com Mon Jul 4 10:38:41 2005 From: wilberforce at gmail.com (xtian) Date: Mon, 4 Jul 2005 09:38:41 +0100 Subject: [IronPython] Error Message In-Reply-To: <4660fe3005070401252552a046@mail.gmail.com> References: <429b380e05070400535fa7372d@mail.gmail.com> <4660fe3005070401252552a046@mail.gmail.com> Message-ID: <8a420c07050704013862341078@mail.gmail.com> Good advice - also, try running tabnanny.py (in the standard library) on your source. On 7/4/05, Konstantin Veretennicov wrote: > On 7/4/05, Shidan wrote: > > Another message I can't figure out is the following: > > > > C:\MontLingua\python>ironpythonconsole MontyLingua.py > > IronPython.Objects.PythonSyntaxError: unexpected token at > > MontyLingua.p > > y:268 > > There is a script in CPython distribution called reindent.py. You may > find it useful. > > - kv > _______________________________________________ > users-ironpython.com mailing list > users-ironpython.com at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From korpse-ironpython at kaydash.za.net Tue Jul 5 16:39:48 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Tue, 05 Jul 2005 16:39:48 +0200 Subject: [IronPython] from X import Y brokenness Message-ID: <42CA9BB4.9090505@kaydash.za.net> Hi, Recently, I've run across a bit of a bug while importing things with the "from X import Y" syntax, when Y is anything but an an attribute of X that already exists. Demonstration: IronPython 0.7.6 on .NET 2.0.50215.44 Copyright (c) Microsoft Corporation. All rights reserved. >>> from foo import bar >>> repr(bar) 'None' >>> from foo.bar import quux >>> repr(quux) '' One can work around the problem by doing a "regular" import first: >>> import foo.bar >>> from foo import bar >>> repr(bar) '' After doing some digging I've come up with a solution. Even though I don't really think it is a clean solution, I've attached the patch anyway. -- Jonathan -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: from-import.patch URL: From coxchen at nature.ee.ncku.edu.tw Wed Jul 6 16:48:49 2005 From: coxchen at nature.ee.ncku.edu.tw (coxchen) Date: Wed, 6 Jul 2005 22:48:49 +0800 Subject: [IronPython] Problems when loading COM object implemented using ctypes Message-ID: <20050706144849.M13232@nature.ee.ncku.edu.tw> Greetings, I implemented a COM server using ctypes module and deployed it using py2exe as a DLL(MyCOMServer.dll). Then I tried to load this COM server with >>> import sys >>> sys.LoadAssemblyFromFile("MyCOMServer.dll") but got an IronPython.Objects.PythonRuntimeError message. Did I miss something important when deploying my COM server so that I cannot load it using "LoadAssemblyByName"? Or this is not the right way to load a COM server in IronPython? Any suggestions will be appreciated! Thank you. - Cox Chen From martmaly at exchange.microsoft.com Wed Jul 6 17:41:45 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Wed, 6 Jul 2005 08:41:45 -0700 Subject: [IronPython] Problems when loading COM object implemented usingctypes Message-ID: <1DFB396200705E46B5338CA4B2E25BDE212F33@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi, To use COM server, you need to create a .NET assembly from the COM assembly type information for .NET to use. There is a tool that is part of .NET SDK - tlbimp.exe - which does that for you. It spits out a .NET binary with the necessary metadata. You then proceed to load the .NET assembly rather than the COM one. Hope this helps Martin ________________________________________ From: coxchen Sent: 7/6/2005 7:48 AM To: users-ironpython.com at lists.ironpython.com Cc: Subject: [IronPython] Problems when loading COM object implemented usingctypes Greetings, I implemented a COM server using ctypes module and deployed it using py2exe as a DLL(MyCOMServer.dll). Then I tried to load this COM server with >>> import sys >>> sys.LoadAssemblyFromFile("MyCOMServer.dll") but got an IronPython.Objects.PythonRuntimeError message. Did I miss something important when deploying my COM server so that I cannot load it using "LoadAssemblyByName"? Or this is not the right way to load a COM server in IronPython? Any suggestions will be appreciated! Thank you. - Cox Chen _______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From freddiewitherden at hotmail.com Wed Jul 6 21:03:58 2005 From: freddiewitherden at hotmail.com (Freddie Witherden) Date: Wed, 06 Jul 2005 19:03:58 +0000 Subject: [IronPython] Making A Windows Form App Message-ID: Hi, I am trying to convert a very simple C# windows form test that I made into IronPython (to see that it can be done). However I have tried over 20 different ways with no luck. Can anyone help me? There is very very little documentation on IronPython, which I think needs to be addressed. The code is: using System; using System.Drawing; using System.Windows.Forms; namespace WinForms { public class HelloWorld : System.Windows.Forms.Form { private Button btn; public HelloWorld() { Text = "Hello World"; btn = new Button(); btn.Location = new Point(50,50); btn.Text = "Goodbye"; btn.Click += new System.EventHandler(btn_Click); Controls.Add(btn); } static void Main() { Application.Run(new HelloWorld()); } private void btn_Click(object sender, EventArgs e) { Application.Exit(); } } } From martmaly at exchange.microsoft.com Wed Jul 6 22:13:17 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Wed, 6 Jul 2005 13:13:17 -0700 Subject: [IronPython] Making A Windows Form App Message-ID: <1DFB396200705E46B5338CA4B2E25BDE3690AB@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi Freddie, Below is the working code. I would be interested to hear what you had most problems with. Common difficulty is the LoadAssemblyByName function. Feel free to post feedback to this discussion alias. We are interested to hear what roadblocks developers encounter as they try to use IronPython. Martin import sys sys.LoadAssemblyByName("System.Drawing") sys.LoadAssemblyByName("System.Windows.Forms") import System from System.Drawing import Point from System.Windows.Forms import Form, Button, Application def on_click(*args): Application.Exit() frm = Form(Text = "Hello World") btn = Button(Text = "Goodbye", Location = Point(50,50)) btn.Click += on_click frm.Controls.Add(btn) Application.Run(frm) > Freddie Witherden Wrote: > > Hi, I am trying to convert a very simple C# windows form test > that I made into IronPython (to see that it can be done). > However I have tried over 20 different ways with no luck. Can > anyone help me? There is very very little documentation on > IronPython, which I think needs to be addressed. The code > is: > using System; > using System.Drawing; > using System.Windows.Forms; > > namespace WinForms > { > public class HelloWorld : System.Windows.Forms.Form > { > > private Button btn; > > public HelloWorld() > { > Text = "Hello World"; > > btn = new Button(); > btn.Location = new Point(50,50); > btn.Text = "Goodbye"; > btn.Click += new System.EventHandler(btn_Click); > > Controls.Add(btn); > } > > static void Main() > { > Application.Run(new HelloWorld()); > } > > private void btn_Click(object sender, EventArgs e) > { > Application.Exit(); > } > } > } From kfarmer at thuban.org Wed Jul 6 22:35:57 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Wed, 6 Jul 2005 13:35:57 -0700 Subject: [IronPython] Making A Windows Form App Message-ID: Out of curiosity, would it be possible to get IronPython to make a best-guess attempt at automatically loading an appropriate assembly, if it discovers that it doesn't know the namespace? This could alleviate the problems people have with remembering sys.LoadAssemblyByName. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Martin Maly Sent: Wed 7/6/2005 1:13 PM import sys sys.LoadAssemblyByName("System.Drawing") sys.LoadAssemblyByName("System.Windows.Forms") -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3655 bytes Desc: not available URL: From jimhug at exchange.microsoft.com Thu Jul 7 02:23:55 2005 From: jimhug at exchange.microsoft.com (Jim Hugunin) Date: Wed, 6 Jul 2005 17:23:55 -0700 Subject: [IronPython] Making A Windows Form App Message-ID: <1DFB396200705E46B5338CA4B2E25BDE369202@DF-BANDIT-MSG.exchange.corp.microsoft.com> We clearly need a better design than the current sys.LoadAssembly* methods. For one thing, we shouldn't really be adding these to the existing sys module but putting new methods like this in a new IronPython module. As you point out, we should also do a better job of making this as invisible to the user as possible. In IronPython-0.6, a much larger number of assemblies were automatically searched for - including the two shown below. This meant that this particular program could run without any of this nonsense. The problem here was that this just delayed the issue of people learning about this issue and made things even more confusing when they wanted to use an assembly that wasn't in the known list. I decided that at this stage it was better to raise this issue front-and-center so that people would be aware of it and hopefully get quickly familiar with it. The other reason I wanted to make this more explicit was in the hopes that it would spur discussion about better ways of solving the problem. I'm certain that sys.LoadAssembly* is not what will ship with IronPython-1.0. Here are a few possible options in no particular order. 1. Guess the assembly based on the path, i.e. import System.Drawing will try to load "System.Drawing". This would be great if it was a naming convention that was consistently followed, but alas it is a rule that is so consistently broken I'm doubtful of the benefits. 2. Add a config file to specific a large set of default known assemblies and have the user extend this with their own. This ties scripts and config files together in a deeper way than I'd prefer. 3. Extend import, i.e. import System.Drawing from System.Drawing. Of course, the most obvious ways to do this are a change to the Python language. 4. Search some well-known directories to come up with a list of known assemblies and their types and then load assemblies strictly as needed for imports. This would add many seconds to start-up time unless this information is cached and caches are their own source of trouble. FYI - This is closest to what Jython does. 5. I'm sure there are other good ideas out there... There's a whole separate question as to whether or not any loading by partial name is too dangerous even as explicit as it is today, see here: http://blogs.msdn.com/suzcook/archive/2003/05/30/57159.aspx Thanks - Jim ________________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Keith J. Farmer Sent: Wednesday, July 06, 2005 1:36 PM To: Discussion of IronPython Subject: RE: [IronPython] Making A Windows Form App Out of curiosity, would it be possible to get IronPython to make a best-guess attempt at automatically loading an appropriate assembly, if it discovers that it doesn't know the namespace? ? This could alleviate the problems people have with remembering sys.LoadAssemblyByName. ________________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Martin Maly Sent: Wed 7/6/2005 1:13 PM import sys sys.LoadAssemblyByName("System.Drawing") sys.LoadAssemblyByName("System.Windows.Forms") From lloyd at nova-mind.com Thu Jul 7 02:33:30 2005 From: lloyd at nova-mind.com (Lloyd Dupont) Date: Thu, 7 Jul 2005 10:33:30 +1000 Subject: [IronPython] Making A Windows Form App References: <1DFB396200705E46B5338CA4B2E25BDE369202@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: <01fa01c5828b$80734470$9800a8c0@gideone14f6c02> I like #3 very much! (the 'from' clause being optional... (in case you import multiple namespace from one assembly)) ----- Original Message ----- From: "Jim Hugunin" 3. Extend import, i.e. import System.Drawing from System.Drawing. Of course, the most obvious ways to do this are a change to the Python language. From kfarmer at thuban.org Thu Jul 7 03:11:10 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Wed, 6 Jul 2005 18:11:10 -0700 Subject: [IronPython] Making A Windows Form App Message-ID: I see problems with #3, at least using those precise keywords. A variant of #3, perhaps reference from System.Drawing import * rather than muddying up "import" and "from" would be suitable for non-standard libraries. "import foo from bar" and "from bar import foo" doesn't really say anything different when I read it. Unfortunately, as you note, a namespace and an assembly are two different beasts (problem with #1). The reference syntax I suggest could address the problem of versioning problems with retrieving assemblies. As for #4 in general. There's a problem of conflicting type names living in peer assemblies. I think it'd best be limited to the BCL and other blessed frameworks, which can (hopefully) be counted on to play nicely with namespaces. Also, notably, these are likely to be candidates for the GAC, or some similar cache. So my thinking: well-known assemblies: ~#4 others, or override: #3 (reference) ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Jim Hugunin Sent: Wed 7/6/2005 5:23 PM To: Discussion of IronPython Subject: RE: [IronPython] Making A Windows Form App We clearly need a better design than the current sys.LoadAssembly* methods. For one thing, we shouldn't really be adding these to the existing sys module but putting new methods like this in a new IronPython module. As you point out, we should also do a better job of making this as invisible to the user as possible. -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 5239 bytes Desc: not available URL: From hank at prosysplus.com Thu Jul 7 03:46:13 2005 From: hank at prosysplus.com (Hank Fay) Date: Wed, 6 Jul 2005 21:46:13 -0400 Subject: [IronPython] Making A Windows Form App In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE369202@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: <20BC94CB2A3A45D090B5786811A5DD.MAI@prosysplus.com> I wonder if the answer can lie in the IDE, sort of an intellisense on steroids. Issue a call to form() and the IDE looks to see if the assemblies that make form() possible are loaded. If not, a list of those (MRU) that can fulfill this are presented in intellisense selector fashion, and the import statements, in what ever fashion, are created. Speaking of which, having a pythonable IDE, instead of the convoluted hoops currently having to be stumbled through, would be a great improvement. If it were as easy to extend as VFP's IDE (Ken Levy on the VS Data team wrote the Builder system for VFP, btw), I'll bet a lot of programmers would start using it to make the IDE do what they want. From which it would be a short step to the promised land. Hank Fay -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Jim Hugunin Sent: Wednesday, July 06, 2005 8:24 PM To: Discussion of IronPython Subject: RE: [IronPython] Making A Windows Form App We clearly need a better design than the current sys.LoadAssembly* methods. For one thing, we shouldn't really be adding these to the existing sys module but putting new methods like this in a new IronPython module. As you point out, we should also do a better job of making this as invisible to the user as possible. .... From wilberforce at gmail.com Thu Jul 7 09:49:00 2005 From: wilberforce at gmail.com (xtian) Date: Thu, 7 Jul 2005 08:49:00 +0100 Subject: [IronPython] Making A Windows Form App In-Reply-To: References: Message-ID: <8a420c070507070049547a2799@mail.gmail.com> On 7/7/05, Keith J. Farmer wrote: > I see problems with #3, at least using those precise keywords. > > A variant of #3, perhaps > > reference > from System.Drawing import * > This seems like a good option - referencing an assembly is essentially orthogonal to importing a namespace. It strikes me as similar to the way PJE's EasyInstall handles dependencies - downloading, installing and adding packages to the module path, ready for importing. If it would preferable to avoid adding a keyword (for compatibility with other implementations), a require() or reference() function that isn't quite the same as LoadAssemblyByName() would do - one that could handle a fully qualified strong name, as well as the more informal ones. > The reference syntax I suggest could address the problem of versioning problems with retrieving assemblies. > > As for #4 in general. There's a problem of conflicting type names living in peer assemblies. I think it'd best be limited to the BCL and other blessed frameworks, which can (hopefully) be counted on to play nicely with namespaces. Also, notably, these are likely to be candidates for the GAC, or some similar cache. > It could essentially do what Jython does, but hold off until the reference() call was issued, to avoid (some) startup penalty. xtian From coxchen at nature.ee.ncku.edu.tw Thu Jul 7 11:19:32 2005 From: coxchen at nature.ee.ncku.edu.tw (Jinghong Cox Chen) Date: Thu, 07 Jul 2005 17:19:32 +0800 Subject: [IronPython] Problems when loading COM object implemented usingctypes In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE212F33@DF-BANDIT-MSG.exchange.corp.microsoft.com> References: <1DFB396200705E46B5338CA4B2E25BDE212F33@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: <20050707171824.7E3D.COXCHEN@nature.ee.ncku.edu.tw> Hi Martin, Yes! This helps a lot. Thank you! - Cox On Wed, 6 Jul 2005 08:41:45 -0700 Martin Maly wrote: > Hi, > > To use COM server, you need to create a .NET assembly from the COM assembly type information for .NET to use. There is a tool that is part of .NET SDK - tlbimp.exe - which does that for you. It spits out a .NET binary with the necessary metadata. You then proceed to load the .NET assembly rather than the COM one. > > Hope this helps > Martin > > ________________________________________ > From: coxchen > Sent: 7/6/2005 7:48 AM > To: users-ironpython.com at lists.ironpython.com > Cc: > Subject: [IronPython] Problems when loading COM object implemented usingctypes > > Greetings, > > I implemented a COM server using ctypes > module and deployed it using py2exe > as a DLL(MyCOMServer.dll). > Then I tried to load this COM server with > > >>> import sys > >>> sys.LoadAssemblyFromFile("MyCOMServer.dll") > > but got an IronPython.Objects.PythonRuntimeError message. > > Did I miss something important when > deploying my COM server so that I cannot > load it using "LoadAssemblyByName"? > Or this is not the right way to load > a COM server in IronPython? > > Any suggestions will be appreciated! > Thank you. > > - Cox Chen > _______________________________________________ > users-ironpython.com mailing list > users-ironpython.com at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- ?Asperges me hyssopo et mundabor ; lavabis me et super nivem dealbabor.? From niki at vintech.bg Thu Jul 7 12:18:56 2005 From: niki at vintech.bg (Niki Spahiev) Date: Thu, 07 Jul 2005 13:18:56 +0300 Subject: [IronPython] Making A Windows Form App In-Reply-To: References: Message-ID: <42CD0190.5040104@vintech.bg> Keith J. Farmer wrote: > I see problems with #3, at least using those precise keywords. > > A variant of #3, perhaps > > reference > from System.Drawing import * or maybe: from iron import declare_ declare_namespaces(assembly, 'System.Drawing', 'System.Drawing.Text', ...) from System.Drawing import * regards, Niki Spahiev From riltim at gmail.com Thu Jul 7 21:09:56 2005 From: riltim at gmail.com (Tim Riley) Date: Thu, 7 Jul 2005 15:09:56 -0400 Subject: [IronPython] Two Questions Message-ID: I am looking to make IronPython .NET assemblies to load into AutoCAD. I know at this point in time there isn't a static compiler for IronPython but it would be nice to know how much of a priority this is and an ETA would be really nice. In order to use the assemblies in AutoCAD I need to compile them to a .dll. Another weird thing I saw in sample code for AutoCAD .NET assemblies is some strange tag for defining user commands in AutoCAD. For C# it is: [CommandMethod("helloworld")] public void HelloWorld() And in VB.NET it is: _ Public Function HelloCommand() I am wonder if anyone knows what they are and if you do would this be possible in IronPython. Thanks, Tim Riley From kfarmer at thuban.org Thu Jul 7 22:22:34 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Thu, 7 Jul 2005 13:22:34 -0700 Subject: [IronPython] Two Questions Message-ID: It's not a "strange tag" .. it's an attribute. Attributes are classes representing metadata which can be inspected at runtime. They're very powerful -- see "Applied .NET Attributes" by Bock & Barnaby. They're used to mark classes as serializable, by the serializer to adjust how serialization takes place, by ASP.NET to mark whether or not to expose a method in a Web Service, by data access layers to mark what tables and fields classes and properties map to, by aspect-oriented frameworks to insert context interceptors, and so on. They're also apparently used by AutoCAD to determine which methods are exposed, and what name to map them to. Really, attributes need to have more air time: anywhere there's information *about* a class or method, they could be used rather than creating more members that are used only by convention (muddying up the API). Were IronPython *not* trying to be so transparent to CPython developers, I imagine doc strings and the like would end up as attributes, rather than reserved members. I would certainly be lobbying for as much (and I wouldn't mind it, still .. __doc__ can remain a Python-ism, within the Python language, and be translated to an attribute inspection -- hint hint). Here's one article on the subject. You're certain to find others: http://www.devarticles.com/c/a/ASP.NET/Demonstrating-Attributes-and-Reflection-in-.NET/1/ To my knowledge, this is a yet-to-be-implemented feature of IronPython, and I'm not sure where it falls in relation to the other items for v1. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Tim Riley Sent: Thu 7/7/2005 12:09 PM To: Discussion of IronPython Subject: [IronPython] Two Questions I am looking to make IronPython .NET assemblies to load into AutoCAD. I know at this point in time there isn't a static compiler for IronPython but it would be nice to know how much of a priority this is and an ETA would be really nice. In order to use the assemblies in AutoCAD I need to compile them to a .dll. Another weird thing I saw in sample code for AutoCAD .NET assemblies is some strange tag for defining user commands in AutoCAD. For C# it is: [CommandMethod("helloworld")] public void HelloWorld() And in VB.NET it is: _ Public Function HelloCommand() -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 5347 bytes Desc: not available URL: From jvm_cop at spamcop.net Fri Jul 8 17:12:00 2005 From: jvm_cop at spamcop.net (J. Merrill) Date: Fri, 08 Jul 2005 11:12:00 -0400 Subject: [IronPython] Python List -> .Net Array (was PowerPoint Automation) In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE368741@DF-BANDIT-MSG.excha nge.corp.microsoft.com> Message-ID: <4.3.2.7.2.20050708110436.07043470@mail.comcast.net> At 05:28 PM 6/30/2005, Martin Maly wrote (in part) >To work with slide ranges, using Python list won't work. Unfortunately, there is no default conversion from the Python list data type to .NET array type(s). Is there a good reason for not having that default conversion? If there is a good reason, should there be an AsArray method (perhaps with another name) added to the Python List class, so that one could do the conversion manually when working with .Net classes? The IronPython code (your sample shown below) for initializing and populating a "normal" .Net array is quite verbose compared to what we get in Python (or even C#). >>> r=System.Array.CreateInstance(System.Int32, 5) >>> r[0]=1 >>> r[1]=4 >>> r[2]=7 >>> r[3]=9 >>> r[4]=12 J. Merrill / Analytical Software Corp From abpillai at gmail.com Mon Jul 11 16:53:09 2005 From: abpillai at gmail.com (Anand Pillai) Date: Mon, 11 Jul 2005 20:23:09 +0530 Subject: [IronPython] IronPython port of HarvestMan Message-ID: <8548c5f305071107532c32500d@mail.gmail.com> Hi I have been lurking around in the list observing the developments. With the 0.7.6 release I felt that I could dip my hands into the fresh forged IronPython without getting burned. I have written an application in pure CPython that is a webcrawler called HarvestMan. It is multithreaded and uses Python threads. I was thinking of trying to make a port of it to IronPython which will bring me to grips with IronPython and .NET in general. HarvestMan uses a number of modules in CPython including urllib/urllib2, threading, SGMLParser etc. Where can I get a start in trying to design an IronPython port? How should I approach the game? Any pointers and suggestions would be helpful. Thanks & Regards -Anand PS: HarvestMan is at http://harvestman.freezope.org . -- Anand B Pillai, Senior Technical Analyst, IPG-DC, Hewlett-Packard India Pvt Ltd, Near Forum,Adugodi, Bangalore - 560030. From Nirmal_C at Dell.com Mon Jul 11 20:52:27 2005 From: Nirmal_C at Dell.com (Nirmal_C at Dell.com) Date: Mon, 11 Jul 2005 13:52:27 -0500 Subject: [IronPython] IronPython port of HarvestMan Message-ID: <4D8F2325E068D94F8F750FDFB1BD36C38CF6B4@blrx2kmbgl101.blr.amer.dell.com> Hi Anand !!! Nice to hear back from u ;-) in list .. I just started the effort of iron python'ng harvest man last week . Thanks - Nirmal s -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Anand Pillai Sent: Monday, July 11, 2005 8:23 PM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] IronPython port of HarvestMan Hi I have been lurking around in the list observing the developments. With the 0.7.6 release I felt that I could dip my hands into the fresh forged IronPython without getting burned. I have written an application in pure CPython that is a webcrawler called HarvestMan. It is multithreaded and uses Python threads. I was thinking of trying to make a port of it to IronPython which will bring me to grips with IronPython and .NET in general. HarvestMan uses a number of modules in CPython including urllib/urllib2, threading, SGMLParser etc. Where can I get a start in trying to design an IronPython port? How should I approach the game? Any pointers and suggestions would be helpful. Thanks & Regards -Anand PS: HarvestMan is at http://harvestman.freezope.org . -- Anand B Pillai, Senior Technical Analyst, IPG-DC, Hewlett-Packard India Pvt Ltd, Near Forum,Adugodi, Bangalore - 560030. _______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From freddiewitherden at hotmail.com Wed Jul 6 23:22:00 2005 From: freddiewitherden at hotmail.com (Freddie Witherden) Date: Wed, 06 Jul 2005 21:22:00 +0000 Subject: [IronPython] Making A Windows Form App In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE3690AB@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: Namespaces are the biggest problem, LoadAssemblyByName and importing modules are always a paint for me. The 'editor' or command line tool is also a bit annoying as you can not copy or paste text from/to it which makes it harder to work with, but when I had a poke about with MSIL Disassembler I found: IronPythonConsole.FancyConsole, is this some kind of more advanced console, as I often make a lot of small programs in IronPython to test things about and something like a nicer IDE would be great, it is not like Jython where I can get a book so better documentation would go a long way. >From: Martin Maly >Reply-To: Discussion of IronPython > >To: "Discussion of IronPython" >Subject: RE: [IronPython] Making A Windows Form App >Date: Wed, 6 Jul 2005 13:13:17 -0700 >MIME-Version: 1.0 >Received: from moutng.kundenserver.de ([212.227.126.183]) by >mc2-f39.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 6 Jul 2005 >13:13:30 -0700 >Received: from [66.33.206.23] (helo=frida.dreamhost.com)by >mxeu13.kundenserver.de with ESMTP (Nemesis),id 0MKsEO-1DqGGy2JMq-0008HJ for >freddie at pislice.com; Wed, 06 Jul 2005 22:13:32 +0200 >Received: from che.dreamhost.com (che.dreamhost.com [66.33.216.23])by >frida.dreamhost.com (Postfix) with ESMTPid 487F516D644; Wed, 6 Jul 2005 >13:13:31 -0700 (PDT) >Received: from che.dreamhost.com (localhost [127.0.0.1])by >che.dreamhost.com (Postfix) with ESMTPid 8C59D1BA82; Wed, 6 Jul 2005 >13:13:28 -0700 (PDT) >Received: from mail1.exchange.microsoft.com >(mail1.exchange.microsoft.com[131.107.76.156])by che.dreamhost.com >(Postfix) with ESMTP id CD58D1BA81for >;Wed, 6 Jul 2005 13:13:23 -0700 >(PDT) >Received: from DF-GWY-01.Exchange.Corp.Microsoft.com ([157.54.54.62]) >bymail1.exchange.microsoft.com over TLS secured channel withMicrosoft >SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 13:11:39 -0700 >Received: from df-hub-01.exchange.corp.microsoft.com (157.54.8.109) >byDF-GWY-01.Exchange.Corp.microsoft.com (157.54.54.62) with MicrosoftSMTP >Server id 8.0.324.11; Wed, 6 Jul 2005 20:11:38 +0000 >Received: from df-hub-01.exchange.corp.microsoft.com ([157.54.8.109]) >bydf-hub-01.exchange.corp.microsoft.com with >MicrosoftSMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 13:11:38 -0700 >Received: from DF-BANDIT-BHD.Exchange.Microsoft.com ([157.54.54.229]) >bydf-hub-01.exchange.corp.microsoft.com over TLS secured channel >withMicrosoft SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 13:11:37 -0700 >X-Message-Info: JGTYoYF78jHWL9MmXrcWU2adrcEMNnu1M4xRlrPMp/U= >Delivered-To: users-ironpython.com at che.dreamhost.com >Content-Class: urn:content-classes:message >X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 >X-OriginalArrivalTime: 06 Jul 2005 20:11:37.0569 >(UTC)FILETIME=[EA18B510:01C58266] >X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [IronPython] Making A >Windows Form App >Thread-Index: AcWCZWV8ChLmjDVBQuSUEVbp1jOpZQAARvlA >X-BeenThere: users-ironpython.com at lists.ironpython.com >X-Mailman-Version: 2.1.5 >Precedence: list >List-Id: Discussion of IronPython > >List-Unsubscribe: >, >List-Archive: > >List-Post: >List-Help: > >List-Subscribe: >, >Errors-To: users-ironpython.com-bounces at lists.ironpython.com >Return-Path: users-ironpython.com-bounces at lists.ironpython.com > >Hi Freddie, > >Below is the working code. I would be interested to hear what you had >most problems with. Common difficulty is the LoadAssemblyByName >function. Feel free to post feedback to this discussion alias. We are >interested to hear what roadblocks developers encounter as they try to >use IronPython. > >Martin > >import sys >sys.LoadAssemblyByName("System.Drawing") >sys.LoadAssemblyByName("System.Windows.Forms") > >import System >from System.Drawing import Point >from System.Windows.Forms import Form, Button, Application > >def on_click(*args): > Application.Exit() > >frm = Form(Text = "Hello World") >btn = Button(Text = "Goodbye", Location = Point(50,50)) > >btn.Click += on_click >frm.Controls.Add(btn) > >Application.Run(frm) > > > > > > > Freddie Witherden Wrote: > > > > Hi, I am trying to convert a very simple C# windows form test > > that I made into IronPython (to see that it can be done). > > However I have tried over 20 different ways with no luck. Can > > anyone help me? There is very very little documentation on > > IronPython, which I think needs to be addressed. The code > > is: > > using System; > > using System.Drawing; > > using System.Windows.Forms; > > > > namespace WinForms > > { > > public class HelloWorld : System.Windows.Forms.Form > > { > > > > private Button btn; > > > > public HelloWorld() > > { > > Text = "Hello World"; > > > > btn = new Button(); > > btn.Location = new Point(50,50); > > btn.Text = "Goodbye"; > > btn.Click += new System.EventHandler(btn_Click); > > > > Controls.Add(btn); > > } > > > > static void Main() > > { > > Application.Run(new HelloWorld()); > > } > > > > private void btn_Click(object sender, EventArgs e) > > { > > Application.Exit(); > > } > > } > > } >_______________________________________________ >users-ironpython.com mailing list >users-ironpython.com at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From freddiewitherden at hotmail.com Thu Jul 7 20:47:39 2005 From: freddiewitherden at hotmail.com (Freddie Witherden) Date: Thu, 07 Jul 2005 18:47:39 +0000 Subject: [IronPython] Making A Windows Form App In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE369202@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: .net is a lot like Java, and we can be quite sure that many moons ago the JPython team (as it was then known) had the same problem with Java modules, and probably had a long and heated debate about it so I think we should do it 'the Jython way' as there have never been any problems with it and lots of people use Jython so it must work. >From: Jim Hugunin >Reply-To: Discussion of IronPython > >To: "Discussion of IronPython" >Subject: RE: [IronPython] Making A Windows Form App >Date: Wed, 6 Jul 2005 17:23:55 -0700 >MIME-Version: 1.0 >Received: from moutng.kundenserver.de ([212.227.126.171]) by >mc4-f18.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 6 Jul 2005 >17:24:13 -0700 >Received: from [66.33.206.23] (helo=frida.dreamhost.com)by >mxeu11.kundenserver.de with ESMTP (Nemesis),id 0MKuA8-1DqKBQ3a3n-0005pt for >freddie at pislice.com; Thu, 07 Jul 2005 02:24:04 +0200 >Received: from che.dreamhost.com (che.dreamhost.com [66.33.216.23])by >frida.dreamhost.com (Postfix) with ESMTPid 880F316D56B; Wed, 6 Jul 2005 >17:24:03 -0700 (PDT) >Received: from che.dreamhost.com (localhost [127.0.0.1])by >che.dreamhost.com (Postfix) with ESMTPid 4D3FB1BA82; Wed, 6 Jul 2005 >17:23:59 -0700 (PDT) >Received: from mail1.exchange.microsoft.com >(mail1.exchange.microsoft.com[131.107.76.156])by che.dreamhost.com >(Postfix) with ESMTP id F39541BA63for >;Wed, 6 Jul 2005 17:23:56 -0700 >(PDT) >Received: from DF-GWY-01.Exchange.Corp.Microsoft.com ([157.54.54.62]) >bymail1.exchange.microsoft.com over TLS secured channel withMicrosoft >SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 >Received: from df-hub-01.exchange.corp.microsoft.com (157.54.8.109) >byDF-GWY-01.Exchange.Corp.microsoft.com (157.54.54.62) with MicrosoftSMTP >Server id 8.0.324.11; Thu, 7 Jul 2005 00:22:12 +0000 >Received: from df-hub-01.exchange.corp.microsoft.com ([157.54.8.109]) >bydf-hub-01.exchange.corp.microsoft.com with >MicrosoftSMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 >Received: from DF-BANDIT-BHD.Exchange.Microsoft.com ([157.54.54.229]) >bydf-hub-01.exchange.corp.microsoft.com over TLS secured channel >withMicrosoft SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 >X-Message-Info: JGTYoYF78jFojgLyvLebIfsbiobYIaFJ60Vutv4BY8A= >Delivered-To: users-ironpython.com at che.dreamhost.com >Content-Class: urn:content-classes:message >X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 >X-OriginalArrivalTime: 07 Jul 2005 00:22:12.0177 >(UTC)FILETIME=[EB6BD410:01C58289] >X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [IronPython] Making A >Windows Form App >Thread-Index: AcWCZWV8ChLmjDVBQuSUEVbp1jOpZQAARvlAAADzv3MAB2xg0A== >X-BeenThere: users-ironpython.com at lists.ironpython.com >X-Mailman-Version: 2.1.5 >Precedence: list >List-Id: Discussion of IronPython > >List-Unsubscribe: >, >List-Archive: > >List-Post: >List-Help: > >List-Subscribe: >, >Errors-To: users-ironpython.com-bounces at lists.ironpython.com >Return-Path: users-ironpython.com-bounces at lists.ironpython.com > >We clearly need a better design than the current sys.LoadAssembly* methods. > For one thing, we shouldn't really be adding these to the existing sys >module but putting new methods like this in a new IronPython module. As >you point out, we should also do a better job of making this as invisible >to the user as possible. > >In IronPython-0.6, a much larger number of assemblies were automatically >searched for - including the two shown below. This meant that this >particular program could run without any of this nonsense. The problem >here was that this just delayed the issue of people learning about this >issue and made things even more confusing when they wanted to use an >assembly that wasn't in the known list. I decided that at this stage it >was better to raise this issue front-and-center so that people would be >aware of it and hopefully get quickly familiar with it. The other reason I >wanted to make this more explicit was in the hopes that it would spur >discussion about better ways of solving the problem. > >I'm certain that sys.LoadAssembly* is not what will ship with >IronPython-1.0. Here are a few possible options in no particular order. > >1. Guess the assembly based on the path, i.e. import System.Drawing will >try to load "System.Drawing". This would be great if it was a naming >convention that was consistently followed, but alas it is a rule that is so >consistently broken I'm doubtful of the benefits. > >2. Add a config file to specific a large set of default known assemblies >and have the user extend this with their own. This ties scripts and config >files together in a deeper way than I'd prefer. > >3. Extend import, i.e. import System.Drawing from System.Drawing. Of >course, the most obvious ways to do this are a change to the Python >language. > >4. Search some well-known directories to come up with a list of known >assemblies and their types and then load assemblies strictly as needed for >imports. This would add many seconds to start-up time unless this >information is cached and caches are their own source of trouble. FYI - >This is closest to what Jython does. > >5. I'm sure there are other good ideas out there... > >There's a whole separate question as to whether or not any loading by >partial name is too dangerous even as explicit as it is today, see here: > >http://blogs.msdn.com/suzcook/archive/2003/05/30/57159.aspx > >Thanks - Jim > > >________________________________________ >From: users-ironpython.com-bounces at lists.ironpython.com >[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of >Keith J. Farmer >Sent: Wednesday, July 06, 2005 1:36 PM >To: Discussion of IronPython >Subject: RE: [IronPython] Making A Windows Form App > >Out of curiosity, would it be possible to get IronPython to make a >best-guess attempt at automatically loading an appropriate assembly, if it >discovers that it doesn't know the namespace? >? >This could alleviate the problems people have with remembering >sys.LoadAssemblyByName. > >________________________________________ >From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Martin >Maly >Sent: Wed 7/6/2005 1:13 PM >import sys >sys.LoadAssemblyByName("System.Drawing") >sys.LoadAssemblyByName("System.Windows.Forms") >_______________________________________________ >users-ironpython.com mailing list >users-ironpython.com at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From martmaly at exchange.microsoft.com Tue Jul 12 00:52:08 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Mon, 11 Jul 2005 15:52:08 -0700 Subject: [IronPython] Documentation Message-ID: <1DFB396200705E46B5338CA4B2E25BDE3D926E@DF-BANDIT-MSG.exchange.corp.microsoft.com> As of this moment there is no official documentation project under way except for the readme that is part of the distribution. The readme gives few examples and covers LoadAssemblyByName. Overall, the documentation story as of now is not a very good one and we need to improve it. As for IronPython and WinForms, I have been successful finding all answers to my WinForms related problems in MSDN documentation. Granted, the documentation shows examples with VB and C#, but the class hierarchy and general information how to use WinForms does apply to IronPython very well. Hope this helps. Martin > -----Original Message----- > From: users-ironpython.com-bounces at lists.ironpython.com > [mailto:users-ironpython.com-bounces at lists.ironpython.com] On > Behalf Of Freddie Witherden > Sent: Friday, July 01, 2005 7:57 AM > To: users-ironpython.com at lists.ironpython.com > Subject: [IronPython] Documentation > > Hi, I would like to know if there is currently any form of > documentation project running for IronPython. As, while I am > very fond of it there are a few things that do need to be > documented, eg import sys > sys.LoadAssemblyByName() > As LoadAssemblyByName is not a standard method of the sys > object. It would be nice to have some information on windows > forms which are also a 'special' > feature of IronPython. From martmaly at exchange.microsoft.com Tue Jul 12 00:54:02 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Mon, 11 Jul 2005 15:54:02 -0700 Subject: [IronPython] Making A Windows Form App Message-ID: <1DFB396200705E46B5338CA4B2E25BDE3D9271@DF-BANDIT-MSG.exchange.corp.microsoft.com> The command line tool that comes with IronPython runs in the standard Windows console. You can set up the console to allow copy'n' paste. To do that: left click on the icon on the upper-left corner of the console window select "Defaults" Check "Quick edit mode" Restart the IronPython. Then you can use mouse to select area on the console. Right click (or Enter) will copy to clipboard and another right click of the mouse will insert the text as a console input. I find this very useful when using the IronPython console. Martin > -----Original Message----- > From: users-ironpython.com-bounces at lists.ironpython.com > [mailto:users-ironpython.com-bounces at lists.ironpython.com] On > Behalf Of Freddie Witherden > Sent: Wednesday, July 06, 2005 2:22 PM > To: users-ironpython.com at lists.ironpython.com > Subject: RE: [IronPython] Making A Windows Form App > > Namespaces are the biggest problem, LoadAssemblyByName and > importing modules are always a paint for me. The 'editor' or > command line tool is also a bit annoying as you can not copy > or paste text from/to it which makes it harder to work with, > but when I had a poke about with MSIL Disassembler I found: > IronPythonConsole.FancyConsole, is this some kind of more > advanced console, as I often make a lot of small programs in > IronPython to test things about and something like a nicer > IDE would be great, it is not like Jython where I can get a > book so better documentation would go a long way. > From martmaly at exchange.microsoft.com Tue Jul 12 01:10:03 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Mon, 11 Jul 2005 16:10:03 -0700 Subject: [IronPython] Embedding. Message-ID: <1DFB396200705E46B5338CA4B2E25BDE3D928E@DF-BANDIT-MSG.exchange.corp.microsoft.com> Sorry for the delay in responding, Alan. For the simplest scenarios you don't need to initialize PythonEngine. For example, consider: class Program { static void Main(string[] args) { PythonEngine e = new PythonEngine(); object r = e.Evaluate("2+2"); //r == 4 } } For the more complicated cases, initialization is often necessary (for example to execute scripts that import modules and need sys.path initialized etc. You can refer to PythonCommandLine.cs to see how the IronPythonConsole initializes the PythonEngine. Essentially, we set up things 1) The sys.path variable (via PythonEngine.AddToPath method) 2) further setup of sys module (via PythonEngine.InitializeModules method) - this sets up sys.version, sys.prefix, sys.executable and sys.exec_prefix attributes 3) import site.py (via PythonEngine.ImportSite method) The interactive initialization is slightly different, but essentially this is all that is needed to get IronPython engine initialized. Hope this helps. Let me know if other questions arise. Martin > Alan Kennedy Wrote: > > Greetings all, > > I've worked a lot with jython in the past, and have often > made use of it by embedding it in java servers. > > I'd like to try the same thing with Ironpython. > > Is there any documentation on how to go about this? I'm > specifically interested in writing ironpython "servlets", > i.e. servicing web requests with ironpython code. > > Under jython, the interpreter has to be initialised before > scripts can be executed. Is a similar initialisation > necessary under ironpython? > > Thanks in advance, > > Regards, > > Alan. From Rakesh.Ravuri at adeasolutions.com Wed Jul 13 15:15:12 2005 From: Rakesh.Ravuri at adeasolutions.com (Rakesh Ravuri) Date: Wed, 13 Jul 2005 18:45:12 +0530 Subject: [IronPython] Making A Windows Form App Message-ID: <6C9354F305A6204092FDDE28F8895E0E01248D59@Blrexch.adeasolutions.com> Hi All, I have implemented a rich text console , using the IConsole interface. Still has bugs, but helps noobs like me in locating methods in a module by simulating intellisense. Also has support for up & down arrow keys to scroll through history & the default copy paste of Rich Text box. To see it action & try it out follow the link below: http://www.eternalillusions.com/Blog/PermaLink,guid,6124596b-b9e2-4254-8 149-15ace49a88dc.aspx I had to make minor modifications to the Ops.cs & PhythonEngine.cs files to get the custom console working. Here are the differences: Ops.cs------------------------------------------------------------------ --------- C:\IronPython-0.7.6>diff -ru C:\IronPython-0.7.6\IronPython-0.7.6-Original\IronP ython\objects\ops.cs C:\IronPython-0.7.6\IronPython-0.7.6\IronPython\Objects\Ops .cs --- C:\IronPython-0.7.6\IronPython-0.7.6-Original\IronPython\objects\ops.cs 2005-06-12 17:01:42.000000000 +0530 +++ C:\IronPython-0.7.6\IronPython-0.7.6\IronPython\Objects\Ops.cs 2005-07- 13 15:54:23.571026400 +0530 @@ -32,6 +32,9 @@ /// Summary description for time. /// public class Ops { + //RR: Added static variable for Custom Console Support + public static IronPython.Hosting.IConsole CurrentConsole = null; + public static object NotImplemented = ""; //!!! need re ally singleton objects public static object Ellipsis = "..."; //!!! @@ -2021,7 +2024,10 @@ public static void PrintNewline() { - PrintNewlineWithDest(sys.stdout); + if (CurrentConsole == null) + PrintNewlineWithDest(sys.stdout); + else + CurrentConsole.WriteLine("", IronPython.Hosting.Style.Out); } public static void PrintNewlineWithDest(object dest) { @@ -2030,15 +2036,35 @@ } public static void Print(object o) { - PrintWithDest(sys.stdout, o); + if (CurrentConsole == null) + PrintWithDest(sys.stdout, o); + else + { + if (o == null) + CurrentConsole.WriteLine("None", IronPython.Hosting.Style.O ut); + else + CurrentConsole.WriteLine(ToString(o), IronPython.Hosting.St yle.Out); + } + } public static void PrintNoNewline(object o) { - PrintWithDestNoNewline(sys.stdout, o); + if (CurrentConsole == null) + PrintWithDestNoNewline(sys.stdout, o); + else + { + if (o==null) + CurrentConsole.Write("None", IronPython.Hosting.Style.Out); + else + CurrentConsole.Write(ToString(o), IronPython.Hosting.Style. Out); + } } public static void PrintComma(object o) { - PrintCommaWithDest(sys.stdout, o); + if (CurrentConsole == null) + PrintCommaWithDest(sys.stdout, o); + else + PrintNoNewline(o); } public static void PrintWithDest(object dest, object o) { Ops.cs------------------------------------------------------------------ --------- PythonEngine.cs--------------------------------------------------------- --------- C:\IronPython-0.7.6>diff -ru C:\IronPython-0.7.6\IronPython-0.7.6-Original\IronP ython\Hosting\PythonEngine.cs C:\IronPython-0.7.6\IronPython-0.7.6\IronPython\Ho sting\PythonEngine.cs --- C:\IronPython-0.7.6\IronPython-0.7.6-Original\IronPython\Hosting\PythonE ngin e.cs 2005-06-13 16:17:38.000000000 +0530 +++ C:\IronPython-0.7.6\IronPython-0.7.6\IronPython\Hosting\PythonEngine.cs 2005-07-06 11:02:53.886841800 +0530 @@ -46,7 +46,7 @@ } public IConsole MyConsole { get { return _console; } - set { _console = value; } + set { _console = value; Ops.CurrentConsole = value; } } public static Version Version { PythonEngine.cs--------------------------------------------------------- --------- Cheers! Rakesh Ravuri -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Martin Maly Sent: Tuesday, July 12, 2005 4:24 AM To: Discussion of IronPython Subject: RE: [IronPython] Making A Windows Form App The command line tool that comes with IronPython runs in the standard Windows console. You can set up the console to allow copy'n' paste. To do that: left click on the icon on the upper-left corner of the console window select "Defaults" Check "Quick edit mode" Restart the IronPython. Then you can use mouse to select area on the console. Right click (or Enter) will copy to clipboard and another right click of the mouse will insert the text as a console input. I find this very useful when using the IronPython console. Martin > -----Original Message----- > From: users-ironpython.com-bounces at lists.ironpython.com > [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf > Of Freddie Witherden > Sent: Wednesday, July 06, 2005 2:22 PM > To: users-ironpython.com at lists.ironpython.com > Subject: RE: [IronPython] Making A Windows Form App > > Namespaces are the biggest problem, LoadAssemblyByName and importing > modules are always a paint for me. The 'editor' or command line tool > is also a bit annoying as you can not copy or paste text from/to it > which makes it harder to work with, but when I had a poke about with > MSIL Disassembler I found: > IronPythonConsole.FancyConsole, is this some kind of more advanced > console, as I often make a lot of small programs in IronPython to test > things about and something like a nicer IDE would be great, it is not > like Jython where I can get a book so better documentation would go a > long way. > _______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From korpse-ironpython at kaydash.za.net Wed Jul 13 20:42:08 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Wed, 13 Jul 2005 20:42:08 +0200 Subject: [IronPython] from X import (...) Message-ID: <42D56080.3050707@kaydash.za.net> Hi, I've noticed that IronPython doesn't yet support the Python2.4 "tuple" syntax when using "from X import (...)", I'm sure this is probably somewhere on the list of "Python2.4 compatability stuff to do". I've attached a patch adding support for this. -- Jonathan -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: tuple-from-import.patch URL: From kbond at free.fr Thu Jul 14 12:18:23 2005 From: kbond at free.fr (kbond at free.fr) Date: Thu, 14 Jul 2005 12:18:23 +0200 Subject: [IronPython] mono and word automation Message-ID: <1121336303.42d63bef2d6c8@imp3-q.free.fr> Hello, I facing some difficulties that remember me java in worth. :-) The good thing with the jvm is that you right it once and you can use you program everywhere, this is amazing but the obscure side of this force is that this is true only if you are using the same level of the JVM. I am started to be addict at ironpython which is for me an easy the best way to prototype on the .Net plateform.Congratulation to all the people making that happen. My problem is the following: I working with an application that required .Net V1.1 python required .Net V2 so I give mono a try since I read that is was supporting ironpython. The result is the following: I can run basic ironpython operation but I was interested by the office automation and it seems that mono does not support it.(see below) C:\Program Files\Mono-1.1.8\bin>mono E:\users\src_Install\IronPython\IronPython- 0.7.6\bin\IronPythonConsole.exe IronPython 0.7.6 on .NET 2.0.50215.16 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys >>> sys.LoadAssemblyByName("Microsoft.Office.Interop.Word") ** (E:\users\src_Install\IronPython\IronPython-0.7.6\bin\IronPythonConsole.exe:6 36): WARNING **: The class System.StringSplitOptions could not be loaded, used i n E:\users\src_Install\IronPython\IronPython-0.7.6\bin\IronPython.dll (token 0x0 1000083) ** (E:\users\src_Install\IronPython\IronPython-0.7.6\bin\IronPythonConsole.exe:6 36): WARNING **: Missing method Split in assembly E:\users\src_Install\IronPytho n\IronPython-0.7.6\bin\IronPython.dll, type String Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object in <0x00000> in <0x000ab> IronPython.Hosting.PythonEngine:RunInteractive () in <0x00065> IronPythonConsole.PythonCommandLine:RunInteractive (IronPython.Host ing.PythonEngine engine) in <0x000a5> IronPythonConsole.PythonCommandLine:Main (System.String[] rawArgs) C:\Program Files\Mono-1.1.8\bin> My questions are the following: Does someone has a trick to run both .net V1.1 and V2 ? Does mono intend to support office automation? Thank you for your help. From richard.hsu at gmail.com Tue Jul 12 22:26:30 2005 From: richard.hsu at gmail.com (Richard Hsu) Date: Tue, 12 Jul 2005 16:26:30 -0400 Subject: [IronPython] Making A Windows Form App In-Reply-To: <20050712190039.0FD161BA63@che.dreamhost.com> References: <20050712190039.0FD161BA63@che.dreamhost.com> Message-ID: <42D42776.5090008@gmail.com> Hi Freddie, Actually you can write the script in a .py file and have IronPythonConsole run it for you. You can code the script in any text editor [or code editor] you want and save it as .py [actually its not mandatory to save as .py any extension will do] then, in the command line, type in IronPythonConsole your-file.py and it will run it for you. You can actually split your code into multiple files and use 'import' to include the code. For Forms Designer, you could use Visual C# to generate the 'controls layout' code for you, then copy and paste it in the .py file, restructure a little and remove the semi-colons and news and extra class names and it will work. I actually started thinking about a C# to python code converter for the 'controls layout' code generated by the Windows Forms designer because its very boring and tedious to do manual conversions [which generally involve deletions :-)]. I actually did the above using SharpDevelop's Form Designer. [http://icsharpcode.net/OpenSource/SD/Default.aspx]. Hope it helps. -- Richard Hsu. [Note. it would be really nice to tie together MyXaml + SharpDevelop + IronPython. Ideas anyone ?] >Date: Wed, 06 Jul 2005 21:22:00 +0000 >From: "Freddie Witherden" >Subject: RE: [IronPython] Making A Windows Form App >To: users-ironpython.com at lists.ironpython.com >Message-ID: >Content-Type: text/plain; format=flowed > >Namespaces are the biggest problem, LoadAssemblyByName and importing modules >are always a paint for me. The 'editor' or command line tool is also a bit >annoying as you can not copy or paste text from/to it which makes it harder >to work with, but when I had a poke about with MSIL Disassembler I found: >IronPythonConsole.FancyConsole, is this some kind of more advanced console, >as I often make a lot of small programs in IronPython to test things about >and something like a nicer IDE would be great, it is not like Jython where I >can get a book so better documentation would go a long way. > > > >>From: Martin Maly >>Reply-To: Discussion of IronPython >> >>To: "Discussion of IronPython" >>Subject: RE: [IronPython] Making A Windows Form App >>Date: Wed, 6 Jul 2005 13:13:17 -0700 >>MIME-Version: 1.0 >>Received: from moutng.kundenserver.de ([212.227.126.183]) by >>mc2-f39.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 6 Jul 2005 >>13:13:30 -0700 >>Received: from [66.33.206.23] (helo=frida.dreamhost.com)by >>mxeu13.kundenserver.de with ESMTP (Nemesis),id 0MKsEO-1DqGGy2JMq-0008HJ for >>freddie at pislice.com; Wed, 06 Jul 2005 22:13:32 +0200 >>Received: from che.dreamhost.com (che.dreamhost.com [66.33.216.23])by >>frida.dreamhost.com (Postfix) with ESMTPid 487F516D644; Wed, 6 Jul 2005 >>13:13:31 -0700 (PDT) >>Received: from che.dreamhost.com (localhost [127.0.0.1])by >>che.dreamhost.com (Postfix) with ESMTPid 8C59D1BA82; Wed, 6 Jul 2005 >>13:13:28 -0700 (PDT) >>Received: from mail1.exchange.microsoft.com >>(mail1.exchange.microsoft.com[131.107.76.156])by che.dreamhost.com >>(Postfix) with ESMTP id CD58D1BA81for >>;Wed, 6 Jul 2005 13:13:23 -0700 >>(PDT) >>Received: from DF-GWY-01.Exchange.Corp.Microsoft.com ([157.54.54.62]) >>bymail1.exchange.microsoft.com over TLS secured channel withMicrosoft >>SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 13:11:39 -0700 >>Received: from df-hub-01.exchange.corp.microsoft.com (157.54.8.109) >>byDF-GWY-01.Exchange.Corp.microsoft.com (157.54.54.62) with MicrosoftSMTP >>Server id 8.0.324.11; Wed, 6 Jul 2005 20:11:38 +0000 >>Received: from df-hub-01.exchange.corp.microsoft.com ([157.54.8.109]) >>bydf-hub-01.exchange.corp.microsoft.com with >>MicrosoftSMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 13:11:38 -0700 >>Received: from DF-BANDIT-BHD.Exchange.Microsoft.com ([157.54.54.229]) >>bydf-hub-01.exchange.corp.microsoft.com over TLS secured channel >>withMicrosoft SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 13:11:37 -0700 >>X-Message-Info: JGTYoYF78jHWL9MmXrcWU2adrcEMNnu1M4xRlrPMp/U= >>Delivered-To: users-ironpython.com at che.dreamhost.com >>Content-Class: urn:content-classes:message >>X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 >>X-OriginalArrivalTime: 06 Jul 2005 20:11:37.0569 >>(UTC)FILETIME=[EA18B510:01C58266] >>X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [IronPython] Making A >>Windows Form App >>Thread-Index: AcWCZWV8ChLmjDVBQuSUEVbp1jOpZQAARvlA >>X-BeenThere: users-ironpython.com at lists.ironpython.com >>X-Mailman-Version: 2.1.5 >>Precedence: list >>List-Id: Discussion of IronPython >> >>List-Unsubscribe: >>, >>List-Archive: >> >>List-Post: >>List-Help: >> >>List-Subscribe: >>, >>Errors-To: users-ironpython.com-bounces at lists.ironpython.com >>Return-Path: users-ironpython.com-bounces at lists.ironpython.com >> >>Hi Freddie, >> >>Below is the working code. I would be interested to hear what you had >>most problems with. Common difficulty is the LoadAssemblyByName >>function. Feel free to post feedback to this discussion alias. We are >>interested to hear what roadblocks developers encounter as they try to >>use IronPython. >> >>Martin >> >>import sys >>sys.LoadAssemblyByName("System.Drawing") >>sys.LoadAssemblyByName("System.Windows.Forms") >> >>import System >> >> >>from System.Drawing import Point >>from System.Windows.Forms import Form, Button, Application > > >>def on_click(*args): >> Application.Exit() >> >>frm = Form(Text = "Hello World") >>btn = Button(Text = "Goodbye", Location = Point(50,50)) >> >>btn.Click += on_click >>frm.Controls.Add(btn) >> >>Application.Run(frm) >> >> >> >> >> >> >> >>>Freddie Witherden Wrote: >>> >>>Hi, I am trying to convert a very simple C# windows form test >>>that I made into IronPython (to see that it can be done). >>>However I have tried over 20 different ways with no luck. Can >>>anyone help me? There is very very little documentation on >>>IronPython, which I think needs to be addressed. The code >>>is: >>>using System; >>>using System.Drawing; >>>using System.Windows.Forms; >>> >>>namespace WinForms >>>{ >>> public class HelloWorld : System.Windows.Forms.Form >>> { >>> >>> private Button btn; >>> >>> public HelloWorld() >>> { >>> Text = "Hello World"; >>> >>> btn = new Button(); >>> btn.Location = new Point(50,50); >>> btn.Text = "Goodbye"; >>> btn.Click += new System.EventHandler(btn_Click); >>> >>> Controls.Add(btn); >>> } >>> >>> static void Main() >>> { >>> Application.Run(new HelloWorld()); >>> } >>> >>> private void btn_Click(object sender, EventArgs e) >>> { >>> Application.Exit(); >>> } >>> } >>>} >>> >>> >>_______________________________________________ >>users-ironpython.com mailing list >>users-ironpython.com at lists.ironpython.com >>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > > >------------------------------ > >Message: 2 >Date: Thu, 07 Jul 2005 18:47:39 +0000 >From: "Freddie Witherden" >Subject: RE: [IronPython] Making A Windows Form App >To: users-ironpython.com at lists.ironpython.com >Message-ID: >Content-Type: text/plain; format=flowed > >.net is a lot like Java, and we can be quite sure that many moons ago the >JPython team (as it was then known) had the same problem with Java modules, >and probably had a long and heated debate about it so I think we should do >it 'the Jython way' as there have never been any problems with it and lots >of people use Jython so it must work. > > > >>From: Jim Hugunin >>Reply-To: Discussion of IronPython >> >>To: "Discussion of IronPython" >>Subject: RE: [IronPython] Making A Windows Form App >>Date: Wed, 6 Jul 2005 17:23:55 -0700 >>MIME-Version: 1.0 >>Received: from moutng.kundenserver.de ([212.227.126.171]) by >>mc4-f18.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 6 Jul 2005 >>17:24:13 -0700 >>Received: from [66.33.206.23] (helo=frida.dreamhost.com)by >>mxeu11.kundenserver.de with ESMTP (Nemesis),id 0MKuA8-1DqKBQ3a3n-0005pt for >>freddie at pislice.com; Thu, 07 Jul 2005 02:24:04 +0200 >>Received: from che.dreamhost.com (che.dreamhost.com [66.33.216.23])by >>frida.dreamhost.com (Postfix) with ESMTPid 880F316D56B; Wed, 6 Jul 2005 >>17:24:03 -0700 (PDT) >>Received: from che.dreamhost.com (localhost [127.0.0.1])by >>che.dreamhost.com (Postfix) with ESMTPid 4D3FB1BA82; Wed, 6 Jul 2005 >>17:23:59 -0700 (PDT) >>Received: from mail1.exchange.microsoft.com >>(mail1.exchange.microsoft.com[131.107.76.156])by che.dreamhost.com >>(Postfix) with ESMTP id F39541BA63for >>;Wed, 6 Jul 2005 17:23:56 -0700 >>(PDT) >>Received: from DF-GWY-01.Exchange.Corp.Microsoft.com ([157.54.54.62]) >>bymail1.exchange.microsoft.com over TLS secured channel withMicrosoft >>SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 >>Received: from df-hub-01.exchange.corp.microsoft.com (157.54.8.109) >>byDF-GWY-01.Exchange.Corp.microsoft.com (157.54.54.62) with MicrosoftSMTP >>Server id 8.0.324.11; Thu, 7 Jul 2005 00:22:12 +0000 >>Received: from df-hub-01.exchange.corp.microsoft.com ([157.54.8.109]) >>bydf-hub-01.exchange.corp.microsoft.com with >>MicrosoftSMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 >>Received: from DF-BANDIT-BHD.Exchange.Microsoft.com ([157.54.54.229]) >>bydf-hub-01.exchange.corp.microsoft.com over TLS secured channel >>withMicrosoft SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 >>X-Message-Info: JGTYoYF78jFojgLyvLebIfsbiobYIaFJ60Vutv4BY8A= >>Delivered-To: users-ironpython.com at che.dreamhost.com >>Content-Class: urn:content-classes:message >>X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 >>X-OriginalArrivalTime: 07 Jul 2005 00:22:12.0177 >>(UTC)FILETIME=[EB6BD410:01C58289] >>X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [IronPython] Making A >>Windows Form App >>Thread-Index: AcWCZWV8ChLmjDVBQuSUEVbp1jOpZQAARvlAAADzv3MAB2xg0A== >>X-BeenThere: users-ironpython.com at lists.ironpython.com >>X-Mailman-Version: 2.1.5 >>Precedence: list >>List-Id: Discussion of IronPython >> >>List-Unsubscribe: >>, >>List-Archive: >> >>List-Post: >>List-Help: >> >>List-Subscribe: >>, >>Errors-To: users-ironpython.com-bounces at lists.ironpython.com >>Return-Path: users-ironpython.com-bounces at lists.ironpython.com >> >>We clearly need a better design than the current sys.LoadAssembly* methods. >> For one thing, we shouldn't really be adding these to the existing sys >>module but putting new methods like this in a new IronPython module. As >>you point out, we should also do a better job of making this as invisible >>to the user as possible. >> >>In IronPython-0.6, a much larger number of assemblies were automatically >>searched for - including the two shown below. This meant that this >>particular program could run without any of this nonsense. The problem >>here was that this just delayed the issue of people learning about this >>issue and made things even more confusing when they wanted to use an >>assembly that wasn't in the known list. I decided that at this stage it >>was better to raise this issue front-and-center so that people would be >>aware of it and hopefully get quickly familiar with it. The other reason I >>wanted to make this more explicit was in the hopes that it would spur >>discussion about better ways of solving the problem. >> >>I'm certain that sys.LoadAssembly* is not what will ship with >>IronPython-1.0. Here are a few possible options in no particular order. >> >>1. Guess the assembly based on the path, i.e. import System.Drawing will >>try to load "System.Drawing". This would be great if it was a naming >>convention that was consistently followed, but alas it is a rule that is so >>consistently broken I'm doubtful of the benefits. >> >>2. Add a config file to specific a large set of default known assemblies >>and have the user extend this with their own. This ties scripts and config >>files together in a deeper way than I'd prefer. >> >>3. Extend import, i.e. import System.Drawing from System.Drawing. Of >>course, the most obvious ways to do this are a change to the Python >>language. >> >>4. Search some well-known directories to come up with a list of known >>assemblies and their types and then load assemblies strictly as needed for >>imports. This would add many seconds to start-up time unless this >>information is cached and caches are their own source of trouble. FYI - >>This is closest to what Jython does. >> >>5. I'm sure there are other good ideas out there... >> >>There's a whole separate question as to whether or not any loading by >>partial name is too dangerous even as explicit as it is today, see here: >> >>http://blogs.msdn.com/suzcook/archive/2003/05/30/57159.aspx >> >>Thanks - Jim >> >> >>________________________________________ >>From: users-ironpython.com-bounces at lists.ironpython.com >>[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of >>Keith J. Farmer >>Sent: Wednesday, July 06, 2005 1:36 PM >>To: Discussion of IronPython >>Subject: RE: [IronPython] Making A Windows Form App >> >>Out of curiosity, would it be possible to get IronPython to make a >>best-guess attempt at automatically loading an appropriate assembly, if it >>discovers that it doesn't know the namespace? >> >>This could alleviate the problems people have with remembering >>sys.LoadAssemblyByName. >> >>________________________________________ >>From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Martin >>Maly >>Sent: Wed 7/6/2005 1:13 PM >>import sys >>sys.LoadAssemblyByName("System.Drawing") >>sys.LoadAssemblyByName("System.Windows.Forms") >>_______________________________________________ >>users-ironpython.com mailing list >>users-ironpython.com at lists.ironpython.com >>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > > >------------------------------ > >Message: 3 >Date: Mon, 11 Jul 2005 15:52:08 -0700 >From: Martin Maly >Subject: RE: [IronPython] Documentation >To: "Discussion of IronPython" > >Message-ID: > <1DFB396200705E46B5338CA4B2E25BDE3D926E at DF-BANDIT-MSG.exchange.corp.microsoft.com> > >Content-Type: text/plain; charset="us-ascii" > >As of this moment there is no official documentation project under way >except >for the readme that is part of the distribution. The readme gives few >examples >and covers LoadAssemblyByName. Overall, the documentation story as of >now is >not a very good one and we need to improve it. > >As for IronPython and WinForms, I have been successful finding all >answers to my >WinForms related problems in MSDN documentation. Granted, the >documentation shows >examples with VB and C#, but the class hierarchy and general information >how to use >WinForms does apply to IronPython very well. > >Hope this helps. > >Martin > > > >>-----Original Message----- >>From: users-ironpython.com-bounces at lists.ironpython.com >>[mailto:users-ironpython.com-bounces at lists.ironpython.com] On >>Behalf Of Freddie Witherden >>Sent: Friday, July 01, 2005 7:57 AM >>To: users-ironpython.com at lists.ironpython.com >>Subject: [IronPython] Documentation >> >>Hi, I would like to know if there is currently any form of >>documentation project running for IronPython. As, while I am >>very fond of it there are a few things that do need to be >>documented, eg import sys >>sys.LoadAssemblyByName() >>As LoadAssemblyByName is not a standard method of the sys >>object. It would be nice to have some information on windows >>forms which are also a 'special' >>feature of IronPython. >> >> > > >------------------------------ > >Message: 4 >Date: Mon, 11 Jul 2005 15:54:02 -0700 >From: Martin Maly >Subject: RE: [IronPython] Making A Windows Form App >To: "Discussion of IronPython" > >Message-ID: > <1DFB396200705E46B5338CA4B2E25BDE3D9271 at DF-BANDIT-MSG.exchange.corp.microsoft.com> > >Content-Type: text/plain; charset="us-ascii" > >The command line tool that comes with IronPython runs in the standard >Windows console. >You can set up the console to allow copy'n' paste. To do that: > >left click on the icon on the upper-left corner of the console window >select "Defaults" >Check "Quick edit mode" >Restart the IronPython. > >Then you can use mouse to select area on the console. Right click (or >Enter) will copy to clipboard >and another right click of the mouse will insert the text as a console >input. I find this very useful >when using the IronPython console. > >Martin > > > >>-----Original Message----- >>From: users-ironpython.com-bounces at lists.ironpython.com >>[mailto:users-ironpython.com-bounces at lists.ironpython.com] On >>Behalf Of Freddie Witherden >>Sent: Wednesday, July 06, 2005 2:22 PM >>To: users-ironpython.com at lists.ironpython.com >>Subject: RE: [IronPython] Making A Windows Form App >> >>Namespaces are the biggest problem, LoadAssemblyByName and >>importing modules are always a paint for me. The 'editor' or >>command line tool is also a bit annoying as you can not copy >>or paste text from/to it which makes it harder to work with, >>but when I had a poke about with MSIL Disassembler I found: >>IronPythonConsole.FancyConsole, is this some kind of more >>advanced console, as I often make a lot of small programs in >>IronPython to test things about and something like a nicer >>IDE would be great, it is not like Jython where I can get a >>book so better documentation would go a long way. >> >> >> > > >------------------------------ > >Message: 5 >Date: Mon, 11 Jul 2005 16:10:03 -0700 >From: Martin Maly >Subject: RE: [IronPython] Embedding. >To: "Discussion of IronPython" > >Message-ID: > <1DFB396200705E46B5338CA4B2E25BDE3D928E at DF-BANDIT-MSG.exchange.corp.microsoft.com> > >Content-Type: text/plain; charset="us-ascii" > >Sorry for the delay in responding, Alan. > >For the simplest scenarios you don't need to initialize PythonEngine. >For example, consider: > >class Program { > static void Main(string[] args) { > PythonEngine e = new PythonEngine(); > object r = e.Evaluate("2+2"); //r == 4 > } >} > >For the more complicated cases, initialization is often necessary (for >example to execute scripts that import modules and need sys.path >initialized etc. You can refer to PythonCommandLine.cs to see how the >IronPythonConsole initializes the PythonEngine. Essentially, we set up >things > >1) The sys.path variable (via PythonEngine.AddToPath method) >2) further setup of sys module (via PythonEngine.InitializeModules >method) > - this sets up sys.version, sys.prefix, sys.executable and >sys.exec_prefix attributes >3) import site.py (via PythonEngine.ImportSite method) > >The interactive initialization is slightly different, but essentially >this is all that is needed to get IronPython engine initialized. > >Hope this helps. Let me know if other questions arise. >Martin > > > >>Alan Kennedy Wrote: >> >>Greetings all, >> >>I've worked a lot with jython in the past, and have often >>made use of it by embedding it in java servers. >> >>I'd like to try the same thing with Ironpython. >> >>Is there any documentation on how to go about this? I'm >>specifically interested in writing ironpython "servlets", >>i.e. servicing web requests with ironpython code. >> >>Under jython, the interpreter has to be initialised before >>scripts can be executed. Is a similar initialisation >>necessary under ironpython? >> >>Thanks in advance, >> >>Regards, >> >>Alan. >> >> > > >------------------------------ > >_______________________________________________ >users-ironpython.com mailing list >users-ironpython.com at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > >End of users-ironpython.com Digest, Vol 12, Issue 9 >*************************************************** > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kfarmer at thuban.org Fri Jul 15 00:59:06 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Thu, 14 Jul 2005 15:59:06 -0700 Subject: [IronPython] Making A Windows Form App Message-ID: As I recall, MyXaml has successfully been used with IronPython, and work has been done on a MyXaml designer, though I don't know how it goes about its business. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Richard Hsu Sent: Tue 7/12/2005 1:26 PM To: users-ironpython.com at lists.ironpython.com Subject: RE: [IronPython] Making A Windows Form App [Note. it would be really nice to tie together MyXaml + SharpDevelop + IronPython. Ideas anyone ?] -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3567 bytes Desc: not available URL: From korpse-ironpython at kaydash.za.net Fri Jul 15 12:47:31 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Fri, 15 Jul 2005 12:47:31 +0200 Subject: [IronPython] Plans for overloads? Message-ID: <42D79443.5030606@kaydash.za.net> Hi, I am curious as to how function-overloads plan on being handled in future versions of IronPython. -- Jonathan From martmaly at exchange.microsoft.com Fri Jul 15 21:25:32 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Fri, 15 Jul 2005 12:25:32 -0700 Subject: [IronPython] Plans for overloads? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE44B4B4@DF-BANDIT-MSG.exchange.corp.microsoft.com> The overloaded function resolution (when IronPython calls .Net) is currently being worked on. You probably read the original code in which IronPython chooses the first callable alternative. The new code does better finds out all methods that can be called and tries to choose the 'best fit'. This solution is still not perfect because Python's binding ruls are inherently different than for example C#'s and IronPython can still arrive at an ambiguous binding. As of this very moment we are looking into the solution that would allow program(-mer) to pinpoint the very overloaded method to be called. I hope this helps. The code will be available in the upcoming release. Martin > Jonathan Jacobs Wrote: > > Hi, > > I am curious as to how function-overloads plan on being > handled in future versions of IronPython. > > -- > Jonathan From freddiewitherden at hotmail.com Thu Jul 14 22:54:44 2005 From: freddiewitherden at hotmail.com (Freddie Witherden) Date: Thu, 14 Jul 2005 20:54:44 +0000 Subject: [IronPython] Making A Windows Form App In-Reply-To: <42D42776.5090008@gmail.com> Message-ID: Something like that would be amazing, has anyone ever used Boa Constructor (it is like visual studio but for python/wxwidgets (wxpython). Amazing tool, but something to convert form designs from form designer into ironpython code would be great. A new project anyone? >From: Richard Hsu >Reply-To: Discussion of IronPython > >To: users-ironpython.com at lists.ironpython.com >Subject: RE: [IronPython] Making A Windows Form App >Date: Tue, 12 Jul 2005 16:26:30 -0400 >MIME-Version: 1.0 >Received: from three.mx.123-reg.co.uk ([195.224.48.124]) by >MC6-F31.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 14 Jul 2005 >13:21:40 -0700 >Received: from [66.33.206.23] (helo=frida.dreamhost.com)by >three.mx.123-reg.co.uk with esmtp (Exim 4.43)id 1DtADB-00074z-6sfor >freddie at pislice.com; Thu, 14 Jul 2005 21:21:37 +0100 >Received: from che.dreamhost.com (che.dreamhost.com [66.33.216.23])by >frida.dreamhost.com (Postfix) with ESMTPid E625B16D68E; Thu, 14 Jul 2005 >13:21:37 -0700 (PDT) >Received: from che.dreamhost.com (localhost [127.0.0.1])by >che.dreamhost.com (Postfix) with ESMTPid 9F0231BA85; Thu, 14 Jul 2005 >13:21:29 -0700 (PDT) >Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.204])by >che.dreamhost.com (Postfix) with ESMTP id E8C4F1BA63for >;Tue, 12 Jul 2005 13:26:36 -0700 >(PDT) >Received: by zproxy.gmail.com with SMTP id i28so20758nzifor >;Tue, 12 Jul 2005 13:26:36 -0700 >(PDT) >Received: by 10.36.61.19 with SMTP id j19mr200299nza;Tue, 12 Jul 2005 >13:26:36 -0700 (PDT) >Received: from ?69.192.231.78? ([69.192.231.78])by mx.gmail.com with ESMTP >id 22sm129349nzn.2005.07.12.13.26.30;Tue, 12 Jul 2005 13:26:36 -0700 (PDT) >X-Message-Info: JGTYoYF78jEb3LuXW5qbzLo0ixou0s5nKq5MeEr/fCA= >Delivered-To: users-ironpython.com at che.dreamhost.com >DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; >d=gmail.com;h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:content-type;b=c3OVPaLcGxo4Xv0OkvhUeAUu4CsuECuNs7rOMMAKMuMJeciCZCsJFWI2WgdPrPvGoTJpuvz65gQbhYFnx0tBhHv2iOqkwyO6QJVE7jTaf+qEdOkW6f1utJUhJbhbfBzNOckBnNWxgS9dmToOhktHXOzef199C9xElqR1F9UpfcM= >User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) >X-Accept-Language: en-us, en >References: <20050712190039.0FD161BA63 at che.dreamhost.com> >X-Mailman-Approved-At: Thu, 14 Jul 2005 13:21:27 -0700 >X-BeenThere: users-ironpython.com at lists.ironpython.com >X-Mailman-Version: 2.1.5 >Precedence: list >List-Id: Discussion of IronPython > >List-Unsubscribe: >, >List-Archive: > >List-Post: >List-Help: > >List-Subscribe: >, >Errors-To: users-ironpython.com-bounces at lists.ironpython.com >Return-Path: users-ironpython.com-bounces at lists.ironpython.com >X-OriginalArrivalTime: 14 Jul 2005 20:21:41.0651 (UTC) >FILETIME=[A5764E30:01C588B1] > >Hi Freddie, > >Actually you can write the script in a .py file and have IronPythonConsole >run it for you. > >You can code the script in any text editor [or code editor] you want and >save it as .py [actually its not mandatory to save as .py any extension >will do] >then, in the command line, type in > >IronPythonConsole your-file.py > >and it will run it for you. > >You can actually split your code into multiple files and use 'import' to >include the code. > >For Forms Designer, you could use Visual C# to generate the 'controls >layout' code for you, then copy and paste it in the .py file, restructure a >little and remove the semi-colons and news and extra class names and it >will work. I actually started thinking about a C# to python code converter >for the 'controls layout' code generated by the Windows Forms designer >because its very boring and tedious to do manual conversions [which >generally involve deletions :-)]. > >I actually did the above using SharpDevelop's Form Designer. >[http://icsharpcode.net/OpenSource/SD/Default.aspx]. > >Hope it helps. > >-- Richard Hsu. > >[Note. it would be really nice to tie together MyXaml + SharpDevelop + >IronPython. Ideas anyone ?] > >>Date: Wed, 06 Jul 2005 21:22:00 +0000 >>From: "Freddie Witherden" >>Subject: RE: [IronPython] Making A Windows Form App >>To: users-ironpython.com at lists.ironpython.com >>Message-ID: >>Content-Type: text/plain; format=flowed >> >>Namespaces are the biggest problem, LoadAssemblyByName and importing >>modules are always a paint for me. The 'editor' or command line tool is >>also a bit annoying as you can not copy or paste text from/to it which >>makes it harder to work with, but when I had a poke about with MSIL >>Disassembler I found: IronPythonConsole.FancyConsole, is this some kind of >>more advanced console, as I often make a lot of small programs in >>IronPython to test things about and something like a nicer IDE would be >>great, it is not like Jython where I can get a book so better >>documentation would go a long way. >> >> >> >>>From: Martin Maly >>>Reply-To: Discussion of IronPython >>> >>>To: "Discussion of IronPython" >>> >>>Subject: RE: [IronPython] Making A Windows Form App >>>Date: Wed, 6 Jul 2005 13:13:17 -0700 >>>MIME-Version: 1.0 >>>Received: from moutng.kundenserver.de ([212.227.126.183]) by >>>mc2-f39.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 6 Jul 2005 >>>13:13:30 -0700 >>>Received: from [66.33.206.23] (helo=frida.dreamhost.com)by >>>mxeu13.kundenserver.de with ESMTP (Nemesis),id 0MKsEO-1DqGGy2JMq-0008HJ >>>for freddie at pislice.com; Wed, 06 Jul 2005 22:13:32 +0200 >>>Received: from che.dreamhost.com (che.dreamhost.com [66.33.216.23])by >>>frida.dreamhost.com (Postfix) with ESMTPid 487F516D644; Wed, 6 Jul 2005 >>>13:13:31 -0700 (PDT) >>>Received: from che.dreamhost.com (localhost [127.0.0.1])by >>>che.dreamhost.com (Postfix) with ESMTPid 8C59D1BA82; Wed, 6 Jul 2005 >>>13:13:28 -0700 (PDT) >>>Received: from mail1.exchange.microsoft.com >>>(mail1.exchange.microsoft.com[131.107.76.156])by che.dreamhost.com >>>(Postfix) with ESMTP id CD58D1BA81for >>>;Wed, 6 Jul 2005 13:13:23 >>>-0700 (PDT) >>>Received: from DF-GWY-01.Exchange.Corp.Microsoft.com ([157.54.54.62]) >>>bymail1.exchange.microsoft.com over TLS secured channel withMicrosoft >>>SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 13:11:39 -0700 >>>Received: from df-hub-01.exchange.corp.microsoft.com (157.54.8.109) >>>byDF-GWY-01.Exchange.Corp.microsoft.com (157.54.54.62) with MicrosoftSMTP >>>Server id 8.0.324.11; Wed, 6 Jul 2005 20:11:38 +0000 >>>Received: from df-hub-01.exchange.corp.microsoft.com ([157.54.8.109]) >>>bydf-hub-01.exchange.corp.microsoft.com with >>>MicrosoftSMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 13:11:38 -0700 >>>Received: from DF-BANDIT-BHD.Exchange.Microsoft.com ([157.54.54.229]) >>>bydf-hub-01.exchange.corp.microsoft.com over TLS secured channel >>>withMicrosoft SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 13:11:37 -0700 >>>X-Message-Info: JGTYoYF78jHWL9MmXrcWU2adrcEMNnu1M4xRlrPMp/U= >>>Delivered-To: users-ironpython.com at che.dreamhost.com >>>Content-Class: urn:content-classes:message >>>X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 >>>X-OriginalArrivalTime: 06 Jul 2005 20:11:37.0569 >>>(UTC)FILETIME=[EA18B510:01C58266] >>>X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [IronPython] Making >>>A Windows Form App >>>Thread-Index: AcWCZWV8ChLmjDVBQuSUEVbp1jOpZQAARvlA >>>X-BeenThere: users-ironpython.com at lists.ironpython.com >>>X-Mailman-Version: 2.1.5 >>>Precedence: list >>>List-Id: Discussion of IronPython >>> >>>List-Unsubscribe: >>>, >>>List-Archive: >>> >>>List-Post: >>>List-Help: >>> >>>List-Subscribe: >>>, >>>Errors-To: users-ironpython.com-bounces at lists.ironpython.com >>>Return-Path: users-ironpython.com-bounces at lists.ironpython.com >>> >>>Hi Freddie, >>> >>>Below is the working code. I would be interested to hear what you had >>>most problems with. Common difficulty is the LoadAssemblyByName >>>function. Feel free to post feedback to this discussion alias. We are >>>interested to hear what roadblocks developers encounter as they try to >>>use IronPython. >>> >>>Martin >>> >>>import sys >>>sys.LoadAssemblyByName("System.Drawing") >>>sys.LoadAssemblyByName("System.Windows.Forms") >>> >>>import System >>> >>> >>>from System.Drawing import Point >>>from System.Windows.Forms import Form, Button, Application >> >> >>>def on_click(*args): >>> Application.Exit() >>> >>>frm = Form(Text = "Hello World") >>>btn = Button(Text = "Goodbye", Location = Point(50,50)) >>> >>>btn.Click += on_click >>>frm.Controls.Add(btn) >>> >>>Application.Run(frm) >>> >>> >>> >>> >>> >>> >>> >>>>Freddie Witherden Wrote: >>>> >>>>Hi, I am trying to convert a very simple C# windows form test >>>>that I made into IronPython (to see that it can be done). >>>>However I have tried over 20 different ways with no luck. Can >>>>anyone help me? There is very very little documentation on >>>>IronPython, which I think needs to be addressed. The code >>>>is: >>>>using System; >>>>using System.Drawing; >>>>using System.Windows.Forms; >>>> >>>>namespace WinForms >>>>{ >>>> public class HelloWorld : System.Windows.Forms.Form >>>> { >>>> >>>> private Button btn; >>>> >>>> public HelloWorld() >>>> { >>>> Text = "Hello World"; >>>> >>>> btn = new Button(); >>>> btn.Location = new Point(50,50); >>>> btn.Text = "Goodbye"; >>>> btn.Click += new System.EventHandler(btn_Click); >>>> >>>> Controls.Add(btn); >>>> } >>>> >>>> static void Main() >>>> { >>>> Application.Run(new HelloWorld()); >>>> } >>>> >>>> private void btn_Click(object sender, EventArgs e) >>>> { >>>> Application.Exit(); >>>> } >>>> } >>>>} >>>> >>>> >>>_______________________________________________ >>>users-ironpython.com mailing list >>>users-ironpython.com at lists.ironpython.com >>>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> >> >> >> >>------------------------------ >> >>Message: 2 >>Date: Thu, 07 Jul 2005 18:47:39 +0000 >>From: "Freddie Witherden" >>Subject: RE: [IronPython] Making A Windows Form App >>To: users-ironpython.com at lists.ironpython.com >>Message-ID: >>Content-Type: text/plain; format=flowed >> >>.net is a lot like Java, and we can be quite sure that many moons ago the >>JPython team (as it was then known) had the same problem with Java >>modules, and probably had a long and heated debate about it so I think we >>should do it 'the Jython way' as there have never been any problems with >>it and lots of people use Jython so it must work. >> >> >> >>>From: Jim Hugunin >>>Reply-To: Discussion of IronPython >>> >>>To: "Discussion of IronPython" >>> >>>Subject: RE: [IronPython] Making A Windows Form App >>>Date: Wed, 6 Jul 2005 17:23:55 -0700 >>>MIME-Version: 1.0 >>>Received: from moutng.kundenserver.de ([212.227.126.171]) by >>>mc4-f18.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 6 Jul 2005 >>>17:24:13 -0700 >>>Received: from [66.33.206.23] (helo=frida.dreamhost.com)by >>>mxeu11.kundenserver.de with ESMTP (Nemesis),id 0MKuA8-1DqKBQ3a3n-0005pt >>>for freddie at pislice.com; Thu, 07 Jul 2005 02:24:04 +0200 >>>Received: from che.dreamhost.com (che.dreamhost.com [66.33.216.23])by >>>frida.dreamhost.com (Postfix) with ESMTPid 880F316D56B; Wed, 6 Jul 2005 >>>17:24:03 -0700 (PDT) >>>Received: from che.dreamhost.com (localhost [127.0.0.1])by >>>che.dreamhost.com (Postfix) with ESMTPid 4D3FB1BA82; Wed, 6 Jul 2005 >>>17:23:59 -0700 (PDT) >>>Received: from mail1.exchange.microsoft.com >>>(mail1.exchange.microsoft.com[131.107.76.156])by che.dreamhost.com >>>(Postfix) with ESMTP id F39541BA63for >>>;Wed, 6 Jul 2005 17:23:56 >>>-0700 (PDT) >>>Received: from DF-GWY-01.Exchange.Corp.Microsoft.com ([157.54.54.62]) >>>bymail1.exchange.microsoft.com over TLS secured channel withMicrosoft >>>SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 >>>Received: from df-hub-01.exchange.corp.microsoft.com (157.54.8.109) >>>byDF-GWY-01.Exchange.Corp.microsoft.com (157.54.54.62) with MicrosoftSMTP >>>Server id 8.0.324.11; Thu, 7 Jul 2005 00:22:12 +0000 >>>Received: from df-hub-01.exchange.corp.microsoft.com ([157.54.8.109]) >>>bydf-hub-01.exchange.corp.microsoft.com with >>>MicrosoftSMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 >>>Received: from DF-BANDIT-BHD.Exchange.Microsoft.com ([157.54.54.229]) >>>bydf-hub-01.exchange.corp.microsoft.com over TLS secured channel >>>withMicrosoft SMTPSVC(6.0.3790.1830); Wed, 6 Jul 2005 17:22:12 -0700 >>>X-Message-Info: JGTYoYF78jFojgLyvLebIfsbiobYIaFJ60Vutv4BY8A= >>>Delivered-To: users-ironpython.com at che.dreamhost.com >>>Content-Class: urn:content-classes:message >>>X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 >>>X-OriginalArrivalTime: 07 Jul 2005 00:22:12.0177 >>>(UTC)FILETIME=[EB6BD410:01C58289] >>>X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [IronPython] Making >>>A Windows Form App >>>Thread-Index: AcWCZWV8ChLmjDVBQuSUEVbp1jOpZQAARvlAAADzv3MAB2xg0A== >>>X-BeenThere: users-ironpython.com at lists.ironpython.com >>>X-Mailman-Version: 2.1.5 >>>Precedence: list >>>List-Id: Discussion of IronPython >>> >>>List-Unsubscribe: >>>, >>>List-Archive: >>> >>>List-Post: >>>List-Help: >>> >>>List-Subscribe: >>>, >>>Errors-To: users-ironpython.com-bounces at lists.ironpython.com >>>Return-Path: users-ironpython.com-bounces at lists.ironpython.com >>> >>>We clearly need a better design than the current sys.LoadAssembly* >>>methods. For one thing, we shouldn't really be adding these to the >>>existing sys module but putting new methods like this in a new IronPython >>>module. As you point out, we should also do a better job of making this >>>as invisible to the user as possible. >>> >>>In IronPython-0.6, a much larger number of assemblies were automatically >>>searched for - including the two shown below. This meant that this >>>particular program could run without any of this nonsense. The problem >>>here was that this just delayed the issue of people learning about this >>>issue and made things even more confusing when they wanted to use an >>>assembly that wasn't in the known list. I decided that at this stage it >>>was better to raise this issue front-and-center so that people would be >>>aware of it and hopefully get quickly familiar with it. The other reason >>>I wanted to make this more explicit was in the hopes that it would spur >>>discussion about better ways of solving the problem. >>> >>>I'm certain that sys.LoadAssembly* is not what will ship with >>>IronPython-1.0. Here are a few possible options in no particular order. >>> >>>1. Guess the assembly based on the path, i.e. import System.Drawing will >>>try to load "System.Drawing". This would be great if it was a naming >>>convention that was consistently followed, but alas it is a rule that is >>>so consistently broken I'm doubtful of the benefits. >>> >>>2. Add a config file to specific a large set of default known assemblies >>>and have the user extend this with their own. This ties scripts and >>>config files together in a deeper way than I'd prefer. >>> >>>3. Extend import, i.e. import System.Drawing from System.Drawing. Of >>>course, the most obvious ways to do this are a change to the Python >>>language. >>> >>>4. Search some well-known directories to come up with a list of known >>>assemblies and their types and then load assemblies strictly as needed >>>for imports. This would add many seconds to start-up time unless this >>>information is cached and caches are their own source of trouble. FYI - >>>This is closest to what Jython does. >>> >>>5. I'm sure there are other good ideas out there... >>> >>>There's a whole separate question as to whether or not any loading by >>>partial name is too dangerous even as explicit as it is today, see here: >>> >>>http://blogs.msdn.com/suzcook/archive/2003/05/30/57159.aspx >>> >>>Thanks - Jim >>> >>> >>>________________________________________ >>>From: users-ironpython.com-bounces at lists.ironpython.com >>>[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of >>>Keith J. Farmer >>>Sent: Wednesday, July 06, 2005 1:36 PM >>>To: Discussion of IronPython >>>Subject: RE: [IronPython] Making A Windows Form App >>> >>>Out of curiosity, would it be possible to get IronPython to make a >>>best-guess attempt at automatically loading an appropriate assembly, if >>>it discovers that it doesn't know the namespace? >>> >>>This could alleviate the problems people have with remembering >>>sys.LoadAssemblyByName. >>> >>>________________________________________ >>>From: users-ironpython.com-bounces at lists.ironpython.com on behalf of >>>Martin Maly >>>Sent: Wed 7/6/2005 1:13 PM >>>import sys >>>sys.LoadAssemblyByName("System.Drawing") >>>sys.LoadAssemblyByName("System.Windows.Forms") >>>_______________________________________________ >>>users-ironpython.com mailing list >>>users-ironpython.com at lists.ironpython.com >>>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> >> >> >> >>------------------------------ >> >>Message: 3 >>Date: Mon, 11 Jul 2005 15:52:08 -0700 >>From: Martin Maly >>Subject: RE: [IronPython] Documentation >>To: "Discussion of IronPython" >> >>Message-ID: >> <1DFB396200705E46B5338CA4B2E25BDE3D926E at DF-BANDIT-MSG.exchange.corp.microsoft.com> >> >>Content-Type: text/plain; charset="us-ascii" >> >>As of this moment there is no official documentation project under way >>except >>for the readme that is part of the distribution. The readme gives few >>examples >>and covers LoadAssemblyByName. Overall, the documentation story as of >>now is >>not a very good one and we need to improve it. >> >>As for IronPython and WinForms, I have been successful finding all >>answers to my >>WinForms related problems in MSDN documentation. Granted, the >>documentation shows >>examples with VB and C#, but the class hierarchy and general information >>how to use >>WinForms does apply to IronPython very well. >> >>Hope this helps. >> >>Martin >> >> >> >>>-----Original Message----- >>>From: users-ironpython.com-bounces at lists.ironpython.com >>>[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of >>>Freddie Witherden >>>Sent: Friday, July 01, 2005 7:57 AM >>>To: users-ironpython.com at lists.ironpython.com >>>Subject: [IronPython] Documentation >>> >>>Hi, I would like to know if there is currently any form of documentation >>>project running for IronPython. As, while I am very fond of it there are >>>a few things that do need to be documented, eg import sys >>>sys.LoadAssemblyByName() >>>As LoadAssemblyByName is not a standard method of the sys object. It >>>would be nice to have some information on windows forms which are also a >>>'special' feature of IronPython. >>> >>> >> >> >>------------------------------ >> >>Message: 4 >>Date: Mon, 11 Jul 2005 15:54:02 -0700 >>From: Martin Maly >>Subject: RE: [IronPython] Making A Windows Form App >>To: "Discussion of IronPython" >> >>Message-ID: >> <1DFB396200705E46B5338CA4B2E25BDE3D9271 at DF-BANDIT-MSG.exchange.corp.microsoft.com> >> >>Content-Type: text/plain; charset="us-ascii" >> >>The command line tool that comes with IronPython runs in the standard >>Windows console. >>You can set up the console to allow copy'n' paste. To do that: >> >>left click on the icon on the upper-left corner of the console window >>select "Defaults" >>Check "Quick edit mode" >>Restart the IronPython. >> >>Then you can use mouse to select area on the console. Right click (or >>Enter) will copy to clipboard >>and another right click of the mouse will insert the text as a console >>input. I find this very useful >>when using the IronPython console. >> >>Martin >> >> >> >>>-----Original Message----- >>>From: users-ironpython.com-bounces at lists.ironpython.com >>>[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of >>>Freddie Witherden >>>Sent: Wednesday, July 06, 2005 2:22 PM >>>To: users-ironpython.com at lists.ironpython.com >>>Subject: RE: [IronPython] Making A Windows Form App >>> >>>Namespaces are the biggest problem, LoadAssemblyByName and importing >>>modules are always a paint for me. The 'editor' or command line tool is >>>also a bit annoying as you can not copy or paste text from/to it which >>>makes it harder to work with, but when I had a poke about with MSIL >>>Disassembler I found: IronPythonConsole.FancyConsole, is this some kind >>>of more advanced console, as I often make a lot of small programs in >>>IronPython to test things about and something like a nicer IDE would be >>>great, it is not like Jython where I can get a book so better >>>documentation would go a long way. >>> >>> >>> >> >> >>------------------------------ >> >>Message: 5 >>Date: Mon, 11 Jul 2005 16:10:03 -0700 >>From: Martin Maly >>Subject: RE: [IronPython] Embedding. >>To: "Discussion of IronPython" >> >>Message-ID: >> <1DFB396200705E46B5338CA4B2E25BDE3D928E at DF-BANDIT-MSG.exchange.corp.microsoft.com> >> >>Content-Type: text/plain; charset="us-ascii" >> >>Sorry for the delay in responding, Alan. >> >>For the simplest scenarios you don't need to initialize PythonEngine. >>For example, consider: >> >>class Program { >> static void Main(string[] args) { >> PythonEngine e = new PythonEngine(); >> object r = e.Evaluate("2+2"); //r == 4 >> } >>} >> >>For the more complicated cases, initialization is often necessary (for >>example to execute scripts that import modules and need sys.path >>initialized etc. You can refer to PythonCommandLine.cs to see how the >>IronPythonConsole initializes the PythonEngine. Essentially, we set up >>things >> >>1) The sys.path variable (via PythonEngine.AddToPath method) >>2) further setup of sys module (via PythonEngine.InitializeModules >>method) >> - this sets up sys.version, sys.prefix, sys.executable and >>sys.exec_prefix attributes >>3) import site.py (via PythonEngine.ImportSite method) >> >>The interactive initialization is slightly different, but essentially >>this is all that is needed to get IronPython engine initialized. >> >>Hope this helps. Let me know if other questions arise. >>Martin >> >> >> >>>Alan Kennedy Wrote: >>> >>>Greetings all, >>> >>>I've worked a lot with jython in the past, and have often made use of it >>>by embedding it in java servers. >>> >>>I'd like to try the same thing with Ironpython. >>> >>>Is there any documentation on how to go about this? I'm specifically >>>interested in writing ironpython "servlets", i.e. servicing web requests >>>with ironpython code. >>> >>>Under jython, the interpreter has to be initialised before scripts can be >>>executed. Is a similar initialisation necessary under ironpython? >>> >>>Thanks in advance, >>> >>>Regards, >>> >>>Alan. >>> >>> >> >> >>------------------------------ >> >>_______________________________________________ >>users-ironpython.com mailing list >>users-ironpython.com at lists.ironpython.com >>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >>End of users-ironpython.com Digest, Vol 12, Issue 9 >>*************************************************** >> >> >> > >_______________________________________________ >users-ironpython.com mailing list >users-ironpython.com at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From korpse-ironpython at kaydash.za.net Fri Jul 15 21:46:42 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Fri, 15 Jul 2005 21:46:42 +0200 Subject: [IronPython] Plans for overloads? In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE44B4B4@DF-BANDIT-MSG.exchange.corp.microsoft.com> References: <1DFB396200705E46B5338CA4B2E25BDE44B4B4@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: <42D812A2.1010300@kaydash.za.net> Martin Maly wrote: > The overloaded function resolution (when IronPython calls .Net) is > currently being worked on. You probably read the original code in which > IronPython chooses the first callable alternative. The new code does > better finds out all methods that can be called and tries to choose the > 'best fit'. At the moment "out" parameters are not really taken into account when matching up signatures, if I'm not mistaken, is this going to be addressed? > This solution is still not perfect because Python's binding ruls are > inherently different than for example C#'s and IronPython can still > arrive at an ambiguous binding. As of this very moment we are looking > into the solution that would allow program(-mer) to pinpoint the very > overloaded method to be called. Something that crossed my mind (and I know it's not really very "Pythonic") regarding "out" parameters was: What about passing a type in the place of an out object, so that you can match up exactly which overload the programmer wants to use? > I hope this helps. The code will be available in the upcoming release. I'm looking forward to it! A little off-topic, I was wondering about kwargs support for reflected methods. I noticed that there is some code that deals with reflected method kwargs, but basically excludes them from the function call and then uses them to try and set attributes on the object. I realise that C# doesn't really have anything like Python's default arguments (I think...I'm no C# programmer) so kwargs aren't *quite* that useful, but it's handy to be able to use dictionary unpacking syntax, or just to "reorder" the arguments, more handy than having the code (try to) set random attributes. I did hack support in, before realising that kwargs weren't quite as useful for reflected methods, as I'd initially thought, but it's not really something pretty. -- Jonathan From martmaly at exchange.microsoft.com Fri Jul 15 22:29:50 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Fri, 15 Jul 2005 13:29:50 -0700 Subject: [IronPython] Plans for overloads? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE44B500@DF-BANDIT-MSG.exchange.corp.microsoft.com> The > Jonathan Jacobs Wrote: > > At the moment "out" parameters are not really taken into > account when matching up signatures, if I'm not mistaken, is > this going to be addressed? The out parameters are the trickiest part. The solution we are working on will hopefully address that problem. If not (or if it is not a pretty one for the out parameters) we will keep looking. The ultimate goal is to achieve state where we can call any particular method without ambiguity, and also do that within the limitations of Python syntax (i.e. Python code object.method(out x) ... is not really an option) > Something that crossed my mind (and I know it's not really very > "Pythonic") regarding "out" parameters was: What about > passing a type in the place of an out object, so that you can > match up exactly which overload the programmer wants to use? We are actually going to do something quite similar. Since I am just beginning to write the code for the method 'pinpointing', I'll have some results later today or after the weekend. Then I'll send along more information. > A little off-topic, I was wondering about kwargs support for > reflected methods. The kwargs support you are seeing is to enable setting properties at construction time. For example: import sys sys.LoadAssemblyByName("System.Windows.Forms") from System.Windows.Forms import * f = Form(Text = "Hello") # <<= the call I agree with you that the kwargs on reflected methods are not as useful as when calling Python methods. For C# programmers that is. Visual Basic programmer could disagree since VB supports passing arguments by name: Public Class Class1 Public Sub Test(ByVal name As String, ByVal age As Integer) End Sub Public Sub X() Test(age:=10, name:="foo") End Sub End Class You are therefore bringing a very interesting point with the kwargs support for reflected methods and we should definitely give it a thought. Martin From kfarmer at thuban.org Fri Jul 15 23:00:44 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Fri, 15 Jul 2005 14:00:44 -0700 Subject: [IronPython] Plans for overloads? Message-ID: These are plans for 0.8, right? -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 2622 bytes Desc: not available URL: From martmaly at exchange.microsoft.com Fri Jul 15 23:05:21 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Fri, 15 Jul 2005 14:05:21 -0700 Subject: [IronPython] Plans for overloads? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE44B529@DF-BANDIT-MSG.exchange.corp.microsoft.com> Yep. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Keith J. Farmer Sent: Friday, July 15, 2005 2:01 PM To: Discussion of IronPython Subject: RE: [IronPython] Plans for overloads? These are plans for 0.8, right? -------------- next part -------------- An HTML attachment was scrubbed... URL: From korpse-ironpython at kaydash.za.net Sat Jul 16 21:19:05 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Sat, 16 Jul 2005 21:19:05 +0200 Subject: [IronPython] Python extensions Message-ID: <42D95DA9.5000606@kaydash.za.net> Hi, Long story short: I'd like to make use of the Python stdlib email-related modules (imaplib, poplib) but these require the use of the _sockets extension (_sockets.pyd), which has not been implemented in IronPython (yet). This got me thinking about extensions in IronPython, currently there is no method to load an extension DLL in IronPython (is there?). I'm not sure if you can just declare a C# class without a namespace. If you can't have no namespace, then how would one implement something like _socket.pyd, without having to rewrite all the applicable stdlib modules? Just some pondering. -- Jonathan From kfarmer at thuban.org Sun Jul 17 00:04:38 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Sat, 16 Jul 2005 15:04:38 -0700 Subject: [IronPython] Python extensions Message-ID: You can -- at least in asp.net 2 -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Saturday, July 16, 2005 12:19 PM To: IronPython List Subject: [IronPython] Python extensions sure if you can just declare a C# class without a namespace. If you From korpse-ironpython at kaydash.za.net Sun Jul 17 12:21:28 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Sun, 17 Jul 2005 12:21:28 +0200 Subject: [IronPython] Python extensions In-Reply-To: References: Message-ID: <42DA3128.3030707@kaydash.za.net> Keith J. Farmer wrote: > You can -- at least in asp.net 2 Yes, it appears you can...however IronPython throws away exported types without a namespace. Not sure what the reason for this may be, I'd have thought that classes from an assembly without a namespace should just belong to the top-level module. -- Jonathan From kfarmer at thuban.org Sun Jul 17 13:21:08 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Sun, 17 Jul 2005 04:21:08 -0700 Subject: [IronPython] Python extensions Message-ID: In C# 2, there is now a root namespace identifier which you can use to disambiguate. That may not yet be supported in IronPython, but I imagine it's probably straightforward to add. from __global__ import * .. or the like -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs Sent: Sunday, July 17, 2005 3:21 AM Yes, it appears you can...however IronPython throws away exported types without a namespace. Not sure what the reason for this may be, I'd have thought that classes from an assembly without a namespace should just belong to the top-level module. From martmaly at exchange.microsoft.com Sun Jul 17 23:04:38 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Sun, 17 Jul 2005 14:04:38 -0700 Subject: [IronPython] Python extensions Message-ID: <1DFB396200705E46B5338CA4B2E25BDE44B6C4@DF-BANDIT-MSG.exchange.corp.microsoft.com> This is a bug in 0.7.6 that has been already fixed. The fix will be available in the closest upcoming release. Martin > Jonathan Jacobs Wrote: > > Keith J. Farmer wrote: > > You can -- at least in asp.net 2 > > Yes, it appears you can...however IronPython throws away > exported types without a namespace. Not sure what the reason > for this may be, I'd have thought that classes from an > assembly without a namespace should just belong to the > top-level module. > > -- > Jonathan From martmaly at exchange.microsoft.com Tue Jul 19 23:45:56 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Tue, 19 Jul 2005 14:45:56 -0700 Subject: [IronPython] Plans for overloads? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE44BE01@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi, Last Friday I promised to send more information about the progress we are making with overloaded method resolution. The solution that we came up with (and it will be available in the nearest release) is based on the way IronPython uses generic types. Consider following code that instantiates generic List: from System.Collections.Generic import * x = List[str]() The index serves as a means to specify the type arguments for the generic type parameters. Similarily, consider method Console.WriteLine: >>> from System import * >>> print Console.WriteLine.__doc__ System.Void WriteLine() System.Void WriteLine(bool) System.Void WriteLine(System.Char) System.Void WriteLine(System.Char[]) System.Void WriteLine(System.Char[], int, int) System.Void WriteLine(System.Decimal) System.Void WriteLine(float) System.Void WriteLine(System.Single) System.Void WriteLine(int) System.Void WriteLine(System.UInt32) System.Void WriteLine(long) System.Void WriteLine(System.UInt64) System.Void WriteLine(object) System.Void WriteLine(str) System.Void WriteLine(str, object) System.Void WriteLine(str, object, object) System.Void WriteLine(str, object, object, object) System.Void WriteLine(str, object, object, object, object) System.Void WriteLine(str, System.Object[]) We can use indexing to select the specific method from the overloads. For example: >>> Console.WriteLine[str]("Hi") Hi >>> Console.WriteLine[Single](3.5) 3.5 >>> Console.WriteLine[int]("Hi") IronPython.Objects.PythonValueError: Bad args for the method >>> print Console.WriteLine[UInt64].__doc__ System.Void WriteLine(System.UInt64) The simple types are quite straightforward. With array and byref parameters, things get little more complicated because IronPython doesn't have syntax for expressing the array or byref types simply. To create array or byref types, use Type.MakeArrayType and Type.MakeByRefType, for example: >>> print Console.WriteLine[Type.MakeArrayType(Char)].__doc__ System.Void WriteLine(System.Char[]) >>> print Double.TryParse[str, Type.MakeByRefType(Double)].__doc__ bool TryParse(str, System.Double&) >>> Double.TryParse[str, Type.MakeByRefType(Double)]("3.5") (True, 3.5) Martin -----Original Message----- From: Martin Maly Sent: Friday, July 15, 2005 1:30 PM To: 'Discussion of IronPython' Subject: RE: [IronPython] Plans for overloads? > Jonathan Jacobs Wrote: > > At the moment "out" parameters are not really taken into account when > matching up signatures, if I'm not mistaken, is this going to be > addressed? The out parameters are the trickiest part. The solution we are working on will hopefully address that problem. If not (or if it is not a pretty one for the out parameters) we will keep looking. The ultimate goal is to achieve state where we can call any particular method without ambiguity, and also do that within the limitations of Python syntax (i.e. Python code object.method(out x) ... is not really an option) > Something that crossed my mind (and I know it's not really very > "Pythonic") regarding "out" parameters was: What about passing a type > in the place of an out object, so that you can match up exactly which > overload the programmer wants to use? We are actually going to do something quite similar. Since I am just beginning to write the code for the method 'pinpointing', I'll have some results later today or after the weekend. Then I'll send along more information. > A little off-topic, I was wondering about kwargs support for reflected > methods. The kwargs support you are seeing is to enable setting properties at construction time. For example: import sys sys.LoadAssemblyByName("System.Windows.Forms") from System.Windows.Forms import * f = Form(Text = "Hello") # <<= the call I agree with you that the kwargs on reflected methods are not as useful as when calling Python methods. For C# programmers that is. Visual Basic programmer could disagree since VB supports passing arguments by name: Public Class Class1 Public Sub Test(ByVal name As String, ByVal age As Integer) End Sub Public Sub X() Test(age:=10, name:="foo") End Sub End Class You are therefore bringing a very interesting point with the kwargs support for reflected methods and we should definitely give it a thought. Martin From jvm_cop at spamcop.net Wed Jul 20 01:00:55 2005 From: jvm_cop at spamcop.net (J. Merrill) Date: Tue, 19 Jul 2005 19:00:55 -0400 Subject: [IronPython] Plans for overloads? In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE44BE01@DF-BANDIT-MSG.excha nge.corp.microsoft.com> Message-ID: <4.3.2.7.2.20050719185832.06ef51c8@mail.comcast.net> That looks like an excellent, and it seems to me quite elegant, solution. What mechanism(s) do you plan to provide for .Net callers to see IronPython functions as "strongly typed" routines, should we want to do that? At 05:45 PM 7/19/2005, Martin Maly wrote >Hi, > >Last Friday I promised to send more information about the progress we >are making with overloaded method resolution. The solution that we came >up with (and it will be available in the nearest release) is based on >the way IronPython uses generic types. Consider following code that >instantiates generic List: > >from System.Collections.Generic import * >x = List[str]() > >The index serves as a means to specify the type arguments for the >generic type parameters. > >Similarily, consider method Console.WriteLine: > >>>> from System import * >>>> print Console.WriteLine.__doc__ >System.Void WriteLine() >System.Void WriteLine(bool) >System.Void WriteLine(System.Char) >System.Void WriteLine(System.Char[]) >System.Void WriteLine(System.Char[], int, int) >System.Void WriteLine(System.Decimal) >System.Void WriteLine(float) >System.Void WriteLine(System.Single) >System.Void WriteLine(int) >System.Void WriteLine(System.UInt32) >System.Void WriteLine(long) >System.Void WriteLine(System.UInt64) >System.Void WriteLine(object) >System.Void WriteLine(str) >System.Void WriteLine(str, object) >System.Void WriteLine(str, object, object) >System.Void WriteLine(str, object, object, object) >System.Void WriteLine(str, object, object, object, object) >System.Void WriteLine(str, System.Object[]) > >We can use indexing to select the specific method from the overloads. >For example: > >>>> Console.WriteLine[str]("Hi") >Hi >>>> Console.WriteLine[Single](3.5) >3.5 >>>> Console.WriteLine[int]("Hi") >IronPython.Objects.PythonValueError: Bad args for the method WriteLine on System.Console> >>>> print Console.WriteLine[UInt64].__doc__ >System.Void WriteLine(System.UInt64) > >The simple types are quite straightforward. With array and byref >parameters, things get little more complicated because IronPython >doesn't have syntax for expressing the array or byref types simply. To >create array or byref types, use Type.MakeArrayType and >Type.MakeByRefType, for example: > >>>> print Console.WriteLine[Type.MakeArrayType(Char)].__doc__ >System.Void WriteLine(System.Char[]) >>>> print Double.TryParse[str, Type.MakeByRefType(Double)].__doc__ >bool TryParse(str, System.Double&) >>>> Double.TryParse[str, Type.MakeByRefType(Double)]("3.5") >(True, 3.5) > >Martin >[snip] J. Merrill / Analytical Software Corp From kfarmer at thuban.org Wed Jul 20 01:02:24 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Tue, 19 Jul 2005 16:02:24 -0700 Subject: [IronPython] Plans for overloads? Message-ID: How would you specify: T4 Foo(T1, T3) T4 Foo() T4 Foo(T3) T4 Foo(T2, T3) T4 Foo(T1, T2, T3) ...? In other words, generic methods with overloads. I'm pretty sure this is legal, but I don't have 2k5 in front of me to check. I think you may need to add something to specify this, eg: Foo[T1, T2 | T1, T3](x1, x3) Foo[T1, T2, T3]() Foo[T1, T2 | T3](x3) Foo[T1 | T2, T3](x2, x3) Foo[ | T1, T2, T3](x1, x2, x3) ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Martin Maly Sent: Tue 7/19/2005 2:45 PM >>> Console.WriteLine[str]("Hi") Hi >>> Console.WriteLine[Single](3.5) 3.5 >>> Console.WriteLine[int]("Hi") IronPython.Objects.PythonValueError: Bad args for the method >>> print Console.WriteLine[UInt64].__doc__ System.Void WriteLine(System.UInt64) -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 4738 bytes Desc: not available URL: From kfarmer at thuban.org Wed Jul 20 01:03:56 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Tue, 19 Jul 2005 16:03:56 -0700 Subject: [IronPython] Plans for overloads? Message-ID: Perhaps ; instead of | ... ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Keith J. Farmer Sent: Tue 7/19/2005 4:02 PM Foo[T1, T2 | T1, T3](x1, x3) Foo[T1, T2, T3]() Foo[T1, T2 | T3](x3) Foo[T1 | T2, T3](x2, x3) Foo[ | T1, T2, T3](x1, x2, x3) -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3630 bytes Desc: not available URL: From korpse-ironpython at kaydash.za.net Wed Jul 20 08:02:42 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Wed, 20 Jul 2005 08:02:42 +0200 Subject: [IronPython] Plans for overloads? In-Reply-To: References: Message-ID: <42DDE902.6060103@kaydash.za.net> Keith J. Farmer wrote: > How would you specify: > > T4 Foo(T1, T3) > T4 Foo() > T4 Foo(T3) > T4 Foo(T2, T3) > T4 Foo(T1, T2, T3) One would expect the first set of []s to classify the generic type and the second set to specify the exact overload. This seems like the least complicated solution (to me, anyway). > I think you may need to add something to specify this, eg: > > Foo[T1, T2 | T1, T3](x1, x3) > Foo[T1, T2, T3]() > Foo[T1, T2 | T3](x3) > Foo[T1 | T2, T3](x2, x3) > Foo[ | T1, T2, T3](x1, x2, x3) That is really not very pretty to look at. -- Jonathan From kfarmer at thuban.org Wed Jul 20 18:25:57 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Wed, 20 Jul 2005 09:25:57 -0700 Subject: [IronPython] Plans for overloads? Message-ID: I didn't see a second set of square brackets. Also, what if what you have is an indexer, in which case the parameter is supplied also with square brackets? Of course it's not very pretty. Do you have a suggestion that addresses my concern? -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Jonathan Jacobs One would expect the first set of []s to classify the generic type and the second set to specify the exact overload. This seems like the least complicated solution (to me, anyway). From kfarmer at thuban.org Wed Jul 20 18:42:08 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Wed, 20 Jul 2005 09:42:08 -0700 Subject: [IronPython] Plans for overloads? Message-ID: Illustrating my concern with indexers: delegate Foo DelegateType(); public static DelegateType this (Type type) { } public Foo() { } x = Foo[typeof(int)]() .. is ambiguous. You can't determine if you've called the constructor, or if you've called the static indexer, passing in the int type, and then executing the delegate returned to get a Foo object to store in x. (forgive the C# bias in the typeof.. I can't recall the equivalent in python) -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Keith J. Farmer Sent: Wednesday, July 20, 2005 9:26 AM To: Discussion of IronPython Subject: RE: [IronPython] Plans for overloads? I didn't see a second set of square brackets. Also, what if what you have is an indexer, in which case the parameter is supplied also with square brackets? From korpse-ironpython at kaydash.za.net Wed Jul 20 18:44:42 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Wed, 20 Jul 2005 18:44:42 +0200 Subject: [IronPython] Plans for overloads? In-Reply-To: References: Message-ID: <42DE7F7A.5030509@kaydash.za.net> Keith J. Farmer wrote: > I didn't see a second set of square brackets. Also, what if what you > have is an indexer, in which case the parameter is supplied also with > square brackets? Then you have a lot of square brackets? ;-) > Of course it's not very pretty. Do you have a suggestion that addresses > my concern? Well, what I meant was that you'd first determine your generic type, then you'd determine which overload, i.e.: result = MyGenericFunction[int][int, str](1, "hi") or if it makes it more clear: func = MyGenericFunction[int] result = func[int, str](1, "hi") Of course, I'm just guessing. -- Jonathan From korpse-ironpython at kaydash.za.net Wed Jul 20 19:06:22 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Wed, 20 Jul 2005 19:06:22 +0200 Subject: [IronPython] Plans for overloads? In-Reply-To: References: Message-ID: <42DE848E.5090702@kaydash.za.net> Keith J. Farmer wrote: > Illustrating my concern with indexers: > > delegate Foo DelegateType(); > public static DelegateType this (Type type) { } > public Foo() { } > > x = Foo[typeof(int)]() .. is ambiguous. You can't determine if you've > called the constructor, or if you've called the static indexer, passing > in the int type, and then executing the delegate returned to get a Foo > object to store in x. I now understand your concern better, unfortunately I'm not C# guru :-( (I hadn't even touched the language up until a few weeks ago.) I can't get your code, as is, to compile, would you mind providing a more complete example? -- Jonathan From kfarmer at thuban.org Wed Jul 20 19:32:07 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Wed, 20 Jul 2005 10:32:07 -0700 Subject: [IronPython] Plans for overloads? Message-ID: It'd have to be later tonight, if I remember. My 2k5 install's at home and I've been spending my nights there learning how to use Exchange as a document source for a website rewrite I'm doing. Of course, I may take the night off for a personal James Doohan memorial movie fest, instead. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Jonathan Jacobs Sent: Wed 7/20/2005 10:06 AM I now understand your concern better, unfortunately I'm not C# guru :-( (I hadn't even touched the language up until a few weeks ago.) I can't get your code, as is, to compile, would you mind providing a more complete example? -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3918 bytes Desc: not available URL: From dw at botanicus.net Wed Jul 20 04:21:57 2005 From: dw at botanicus.net (David Wilson) Date: Wed, 20 Jul 2005 03:21:57 +0100 Subject: [IronPython] Plans for overloads? In-Reply-To: References: Message-ID: <20050720022156.GA86233@thailand.botanicus.net> On Tue, Jul 19, 2005 at 04:03:56PM -0700, Keith J. Farmer wrote: > Perhaps ; instead of | ... CPython couldn't parse that, so you couldn't write modules that worked on both platforms that made use of FePy extensions. David. > From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Keith J. Farmer > Sent: Tue 7/19/2005 4:02 PM > > > Foo[T1, T2 | T1, T3](x1, x3) > Foo[T1, T2, T3]() > Foo[T1, T2 | T3](x3) > Foo[T1 | T2, T3](x2, x3) > Foo[ | T1, T2, T3](x1, x2, x3) > -- Every program of any complexity written in a procedural language will have a [half-assed] implementation of object oriented design. -- Regurgitated quote from a poster on comp.lang.python From kfarmer at thuban.org Wed Jul 20 20:14:13 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Wed, 20 Jul 2005 11:14:13 -0700 Subject: [IronPython] Plans for overloads? Message-ID: I don't think it matters.. CPython doesn't understand List[int][0] = 1, anyway. We're purely within the .NET realm with this, I think. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of David Wilson Sent: Tue 7/19/2005 7:21 PM To: Discussion of IronPython Subject: Re: [IronPython] Plans for overloads? On Tue, Jul 19, 2005 at 04:03:56PM -0700, Keith J. Farmer wrote: > Perhaps ; instead of | ... CPython couldn't parse that, so you couldn't write modules that worked on both platforms that made use of FePy extensions. -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3574 bytes Desc: not available URL: From martmaly at exchange.microsoft.com Wed Jul 20 20:18:13 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Wed, 20 Jul 2005 11:18:13 -0700 Subject: [IronPython] Plans for overloads? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE44C0BA@DF-BANDIT-MSG.exchange.corp.microsoft.com> Yes, we are in .NET realm, but we are still trying to find solution that doesn't require change to the Python syntax. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Keith J. Farmer Sent: Wednesday, July 20, 2005 11:14 AM To: Discussion of IronPython Subject: RE: [IronPython] Plans for overloads? I don't think it matters.. CPython doesn't understand List[int][0] = 1, anyway. We're purely within the .NET realm with this, I think. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of David Wilson Sent: Tue 7/19/2005 7:21 PM To: Discussion of IronPython Subject: Re: [IronPython] Plans for overloads? On Tue, Jul 19, 2005 at 04:03:56PM -0700, Keith J. Farmer wrote: > Perhaps ; instead of | ... CPython couldn't parse that, so you couldn't write modules that worked on both platforms that made use of FePy extensions. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dw at botanicus.net Wed Jul 20 22:26:34 2005 From: dw at botanicus.net (David Wilson) Date: Wed, 20 Jul 2005 21:26:34 +0100 Subject: [IronPython] Plans for overloads? In-Reply-To: References: Message-ID: <20050720202634.GA69487@thailand.botanicus.net> On Wed, Jul 20, 2005 at 11:14:13AM -0700, Keith J. Farmer wrote: > I don't think it matters.. CPython doesn't understand List[int][0] = > 1, anyway. We're purely within the .NET realm with this, I think. Nope. Using a semicolon would cause the expression to be syntactically invalid, whereas using a pipe would make it an OR expression, which CPython could parse and compile, but it would still be unable to execute. This means you can encapsulate FePy-specific functionality in classes or functions that never get called from CPython, and provide alternative functionality wrapped in a separate function or class, for when the module is running on CPython. http://python.tcpd.net/doc/2.4.1/ref/bitwise.html In CPython, your example expression could even still be executed, f.e. if List were a mapping, that contained a key, whos value was a list containing at least one item. HTH, David. PS: Apologies for the message not making it to the list, my original e-mail address change request seems to have been eaten by Mailman. -- Now that my house has burned down I have a much better view of the moon. From kfarmer at thuban.org Wed Jul 20 22:45:16 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Wed, 20 Jul 2005 13:45:16 -0700 Subject: [IronPython] Plans for overloads? Message-ID: I think my objection to the pipe would be that it's a stretch to type, and has visual conflict with I, 1, and l, depending on the display font. Perhaps colon, rather than semicolon? I can still see conflict potential unless Guido agrees to allow CPython to safely parse some new delimiters for this sake. -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3138 bytes Desc: not available URL: From shhgs.efhilt at gmail.com Thu Jul 21 01:18:25 2005 From: shhgs.efhilt at gmail.com (shhgs) Date: Wed, 20 Jul 2005 19:18:25 -0400 Subject: [IronPython] How to call IronPython Interpreter with C# code? Message-ID: <32b590a05072016187bf26bba@mail.gmail.com> Can somebody tell me how to call IronPython Interpreter with C# code, so that I can embed Python into the .NET application. Thank you! From martmaly at exchange.microsoft.com Thu Jul 21 22:50:12 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Thu, 21 Jul 2005 13:50:12 -0700 Subject: [IronPython] How to call IronPython Interpreter with C# code? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE4C22D7@DF-BANDIT-MSG.exchange.corp.microsoft.com> You can call IronPython through the IronPython.Hosting.PythonEngine object. Here's a trivial example: using IronPython.Hosting; class Program { static void Main(string[] args) { PythonEngine engine = new PythonEngine(); Console.WriteLine( engine.Evaluate("2 + 2") ); } } To get this to compile, add reference to IronPython.dll The other interesting methods on PythonEngine are: public void AddToPath(string dirName); ... adds path to sys.path public void Execute(string text); public object Evaluate(string expr); public void ExecuteFile(string fileName); public int RunFileInNewModule(string fileName); Here is another example, little more interesting, I think. The program (running as Embed.exe) will execute the Python statement, which in turn will load the Embed's type information and modify the static field. using System; using IronPython.Hosting; namespace Embed { public class Program { public static int Value = 0; static void Main(string[] args) { PythonEngine engine = new PythonEngine(); engine.Execute( "import sys \n" + "sys.LoadAssemblyByName(\"Embed\") \n"+ "import Embed \n" + "Embed.Program.Value = 20 \n"); Console.WriteLine(Value); } } } And the last example that goes even further and uses SetVariable method: using System; using IronPython.Hosting; using System.Windows.Forms; namespace Embed { public class Program { static void Main(string[] args) { PythonEngine engine = new PythonEngine(); Form form = new Form(); engine.SetVariable("form", form); engine.Execute( "import sys \n" + "sys.LoadAssemblyByName('System.Windows.Forms') \n" + "from System.Windows.Forms import Button \n" + "def on_exit(*args): \n" + " Application.Exit() \n" + "b = Button(Text='Exit') \n" + "b.Click += on_exit \n" + "form.Controls.Add(b) \n" + "form.Show() \n"); Application.Run(); } } } I hope this helps. Martin -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of shhgs Sent: Wednesday, July 20, 2005 4:18 PM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] How to call IronPython Interpreter with C# code? Can somebody tell me how to call IronPython Interpreter with C# code, so that I can embed Python into the .NET application. Thank you! From ironpython at mmm-experts.com Thu Jul 21 23:40:50 2005 From: ironpython at mmm-experts.com (Morgan Martinet) Date: Thu, 21 Jul 2005 17:40:50 -0400 Subject: [IronPython] How to call IronPython Interpreter with C# code? In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE4C22D7@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: <200507212141.j6LLf8wT022283@aeimail.aei.ca> Hi Martin, Thanks for the examples! > using System; > using IronPython.Hosting; > > namespace Embed { > public class Program { > public static int Value = 0; > > static void Main(string[] args) { > PythonEngine engine = new PythonEngine(); > > engine.Execute( > "import sys \n" + > "sys.LoadAssemblyByName(\"Embed\") \n"+ > "import Embed \n" + > "Embed.Program.Value = 20 \n"); > > Console.WriteLine(Value); > } > } > } Why don't you use the C# string notation that allows you to have multiple lines of text (as in Python with the triple quote notation)? static void Main(string[] args) { PythonEngine engine = new PythonEngine(); engine.Execute(@" import sys sys.LoadAssemblyByName('Embed') import Embed Embed.Program.Value = 20 "); > And the last example that goes even further and uses SetVariable method: > > using System; > using IronPython.Hosting; > using System.Windows.Forms; > > namespace Embed { > public class Program { > static void Main(string[] args) { > PythonEngine engine = new PythonEngine(); > > Form form = new Form(); > engine.SetVariable("form", form); > > engine.Execute( > "import sys \n" > + > "sys.LoadAssemblyByName('System.Windows.Forms') \n" > + > "from System.Windows.Forms import Button \n" > + > "def on_exit(*args): \n" > + > " Application.Exit() \n" > + > "b = Button(Text='Exit') \n" > + > "b.Click += on_exit \n" > + > "form.Controls.Add(b) \n" > + > "form.Show() > \n"); > > Application.Run(); > } > } > } Does it make any difference if you invoke Application.Run from the Python script or from C#? Thanks, Morgan Martinet From ironpython at mmm-experts.com Thu Jul 21 23:46:25 2005 From: ironpython at mmm-experts.com (Morgan Martinet) Date: Thu, 21 Jul 2005 17:46:25 -0400 Subject: [IronPython] Plans for overloads? In-Reply-To: Message-ID: <200507212146.j6LLkiwT027464@aeimail.aei.ca> Hi, Did you guys have a look at the new Python decorators that are a little like .Net meta attributes? You can also see how it can be applied to function overloading, in a Guido's short article: http://www.artima.com/weblogs/viewpost.jsp?thread=101605 I know this is purely Python stuff, but maybe it could help for the new syntax you're investigating... Morgan From martmaly at exchange.microsoft.com Thu Jul 21 23:53:42 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Thu, 21 Jul 2005 14:53:42 -0700 Subject: [IronPython] How to call IronPython Interpreter with C# code? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE4C235F@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi Morgan, > Morgan Martinet Wrote: > > Why don't you use the C# string notation that allows you to > have multiple lines of text (as in Python with the triple > quote notation)? The perfectionist side of me doesn't like what it does to the code formatting :( (for the record, I like the C way best, to concatenate sequence of strings automatically, no "+" needed) > Does it make any difference if you invoke Application.Run > from the Python script or from C#? Not really, the only difference is really that the message loop then runs little deeper in the call stack, but that's all. Martin From coreyhaines at gmail.com Fri Jul 22 00:10:55 2005 From: coreyhaines at gmail.com (Corey Haines) Date: Thu, 21 Jul 2005 18:10:55 -0400 Subject: [IronPython] How to call IronPython Interpreter with C# code? In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE4C22D7@DF-BANDIT-MSG.exchange.corp.microsoft.com> References: <1DFB396200705E46B5338CA4B2E25BDE4C22D7@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: <6bdacb70507211510479454a5@mail.gmail.com> Wow! Thanks, Martin. That actually helps me out quite a bit, as well. I took a look at the console code to see how it does it, but this puts it into a much more concise form. I'd like to use ironpython as the scripting language for my system, and this will make it much easier. -Corey On 7/21/05, Martin Maly wrote: > You can call IronPython through the IronPython.Hosting.PythonEngine > object. > Here's a trivial example: > > using IronPython.Hosting; > class Program { > static void Main(string[] args) { > PythonEngine engine = new PythonEngine(); > Console.WriteLine( engine.Evaluate("2 + 2") ); > } > } > > To get this to compile, add reference to IronPython.dll > > The other interesting methods on PythonEngine are: > > public void AddToPath(string dirName); ... adds path to > sys.path > public void Execute(string text); > public object Evaluate(string expr); > public void ExecuteFile(string fileName); > public int RunFileInNewModule(string fileName); > > > Here is another example, little more interesting, I think. The program > (running as Embed.exe) will > execute the Python statement, which in turn will load the Embed's type > information and modify the static field. > > using System; > using IronPython.Hosting; > > namespace Embed { > public class Program { > public static int Value = 0; > > static void Main(string[] args) { > PythonEngine engine = new PythonEngine(); > > engine.Execute( > "import sys \n" + > "sys.LoadAssemblyByName(\"Embed\") \n"+ > "import Embed \n" + > "Embed.Program.Value = 20 \n"); > > Console.WriteLine(Value); > } > } > } > > And the last example that goes even further and uses SetVariable method: > > using System; > using IronPython.Hosting; > using System.Windows.Forms; > > namespace Embed { > public class Program { > static void Main(string[] args) { > PythonEngine engine = new PythonEngine(); > > Form form = new Form(); > engine.SetVariable("form", form); > > engine.Execute( > "import sys \n" > + > "sys.LoadAssemblyByName('System.Windows.Forms') \n" > + > "from System.Windows.Forms import Button \n" > + > "def on_exit(*args): \n" > + > " Application.Exit() \n" > + > "b = Button(Text='Exit') \n" > + > "b.Click += on_exit \n" > + > "form.Controls.Add(b) \n" > + > "form.Show() > \n"); > > Application.Run(); > } > } > } > > I hope this helps. > > Martin > > -----Original Message----- > From: users-ironpython.com-bounces at lists.ironpython.com > [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of > shhgs > Sent: Wednesday, July 20, 2005 4:18 PM > To: users-ironpython.com at lists.ironpython.com > Subject: [IronPython] How to call IronPython Interpreter with C# code? > > Can somebody tell me how to call IronPython Interpreter with C# code, so > that I can embed Python into the .NET application. > > Thank you! > _______________________________________________ > users-ironpython.com mailing list > users-ironpython.com at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From kfarmer at thuban.org Fri Jul 22 00:13:04 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Thu, 21 Jul 2005 15:13:04 -0700 Subject: [IronPython] Plans for overloads? Message-ID: Interesting, but this seems to be purely for decorating method definitions, not method calls, and I'm not sure how any similar syntax would help. The only thing I could think of would be to hint the parser, which may be what you had in mind. def foo(int) def foo(string) def bar[T](T, int) def bar[T](T, string) foo(/* int */ 1) foo(/* string */ "one") bar[baz](bazVal, /* int */ 1) ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Morgan Martinet Sent: Thu 7/21/2005 2:46 PM I know this is purely Python stuff, but maybe it could help for the new syntax you're investigating... -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 4090 bytes Desc: not available URL: From jimhug at exchange.microsoft.com Fri Jul 22 00:55:49 2005 From: jimhug at exchange.microsoft.com (Jim Hugunin) Date: Thu, 21 Jul 2005 15:55:49 -0700 Subject: [IronPython] How to call IronPython Interpreter with C# code? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE4C23C6@DF-BANDIT-MSG.exchange.corp.microsoft.com> This is a good example, but I think that using Execute to load the assembly by name is a dangerous approach. I'd strongly suggest loading your assemblies using the following API - this is likely to be a standard idiom for making the program's classes available to a script: engine.LoadAssembly(typeof(Program).Assembly); In fact, I'd go so far as to suggest the value of adding a variable to the namespace before running the user's script, something like this: engine.SetVariable("program", typeof(Program)); My two cents - Jim -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Corey Haines Sent: Thursday, July 21, 2005 3:11 PM To: Discussion of IronPython Subject: Re: [IronPython] How to call IronPython Interpreter with C# code? Wow! Thanks, Martin. That actually helps me out quite a bit, as well. I took a look at the console code to see how it does it, but this puts it into a much more concise form. I'd like to use ironpython as the scripting language for my system, and this will make it much easier. -Corey On 7/21/05, Martin Maly wrote: > You can call IronPython through the IronPython.Hosting.PythonEngine > object. > Here's a trivial example: > > using IronPython.Hosting; > class Program { > static void Main(string[] args) { > PythonEngine engine = new PythonEngine(); > Console.WriteLine( engine.Evaluate("2 + 2") ); > } > } > > To get this to compile, add reference to IronPython.dll > > The other interesting methods on PythonEngine are: > > public void AddToPath(string dirName); ... adds path to > sys.path > public void Execute(string text); > public object Evaluate(string expr); > public void ExecuteFile(string fileName); > public int RunFileInNewModule(string fileName); > > > Here is another example, little more interesting, I think. The program > (running as Embed.exe) will > execute the Python statement, which in turn will load the Embed's type > information and modify the static field. > > using System; > using IronPython.Hosting; > > namespace Embed { > public class Program { > public static int Value = 0; > > static void Main(string[] args) { > PythonEngine engine = new PythonEngine(); > > engine.Execute( > "import sys \n" + > "sys.LoadAssemblyByName(\"Embed\") \n"+ > "import Embed \n" + > "Embed.Program.Value = 20 \n"); > > Console.WriteLine(Value); > } > } > } > > And the last example that goes even further and uses SetVariable method: > > using System; > using IronPython.Hosting; > using System.Windows.Forms; > > namespace Embed { > public class Program { > static void Main(string[] args) { > PythonEngine engine = new PythonEngine(); > > Form form = new Form(); > engine.SetVariable("form", form); > > engine.Execute( > "import sys \n" > + > "sys.LoadAssemblyByName('System.Windows.Forms') \n" > + > "from System.Windows.Forms import Button \n" > + > "def on_exit(*args): \n" > + > " Application.Exit() \n" > + > "b = Button(Text='Exit') \n" > + > "b.Click += on_exit \n" > + > "form.Controls.Add(b) \n" > + > "form.Show() > \n"); > > Application.Run(); > } > } > } > > I hope this helps. > > Martin > > -----Original Message----- > From: users-ironpython.com-bounces at lists.ironpython.com > [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of > shhgs > Sent: Wednesday, July 20, 2005 4:18 PM > To: users-ironpython.com at lists.ironpython.com > Subject: [IronPython] How to call IronPython Interpreter with C# code? > > Can somebody tell me how to call IronPython Interpreter with C# code, so > that I can embed Python into the .NET application. > > Thank you! > _______________________________________________ > users-ironpython.com mailing list > users-ironpython.com at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From ironpython at mmm-experts.com Fri Jul 22 01:19:15 2005 From: ironpython at mmm-experts.com (Morgan Martinet) Date: Thu, 21 Jul 2005 19:19:15 -0400 Subject: [IronPython] Plans for overloads? In-Reply-To: Message-ID: <200507212319.j6LNJYEq001270@aeimail.aei.ca> >Interesting, but this seems to be purely for decorating method definitions, >not method calls, and I'm not sure how any similar syntax would help. This is not completely true. The way decorators work is that they wrap the decorated object (either the function or another decorator if you cascade them). The decorator is a Python object by itself, that can override __call__?to implement its own behaviour, allowing you to route the call to the proper method for instance. The decorator object can also contain its own attributes that would help it take the right decision... >The only thing I could think of would be to hint the parser, which may be >what you had in mind. This is also a possibility as it would respect the Python syntax but would allow you to introduce new attributes... Morgan From hostetlerm at gmail.com Fri Jul 22 07:33:36 2005 From: hostetlerm at gmail.com (Mike Hostetler) Date: Fri, 22 Jul 2005 00:33:36 -0500 Subject: [IronPython] Bug in re module Message-ID: When trying to local a "simple" regular expression, I get the following: $ IronPython-0.7.6/bin/IronPythonConsole.exe IronPython 0.7.6 on .NET 2.0.50215.44 Copyright (c) Microsoft Corporation. All rights reserved. >>> import re >>> sect = re.compile('\[(?P
[^]]+)\]') System.ArgumentException: parsing "\[(?P
[^]]+)\]" - Unrecognized groupin g construct. at System.Text.RegularExpressions.RegexParser.ScanGroupOpen() at System.Text.RegularExpressions.RegexParser.ScanRegex() at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions o p) at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions op tions, Boolean useCache) at System.Text.RegularExpressions.Regex..ctor(String pattern) at input_1.Run(Frame frame) It seems to not like the group name. -- Mike Hostetler http://www.binary.net/thehaas From kfarmer at thuban.org Fri Jul 22 08:37:12 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Thu, 21 Jul 2005 23:37:12 -0700 Subject: [IronPython] Bug in re module Message-ID: Looks like it's using the .NET RegEx library. Here's the reference, in case there are syntax differences in the RegEx language used: http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconRegularExpres sionsLanguageElements.asp Grouping Constructs: http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconGroupingConst ructs.asp -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Mike Hostetler >>> sect = re.compile('\[(?P
[^]]+)\]') System.ArgumentException: parsing "\[(?P
[^]]+)\]" - Unrecognized grouping construct. at System.Text.RegularExpressions.RegexParser.ScanGroupOpen() at System.Text.RegularExpressions.RegexParser.ScanRegex() at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op) at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, Boolean useCache) at System.Text.RegularExpressions.Regex..ctor(String pattern) at input_1.Run(Frame frame) It seems to not like the group name. From korpse-ironpython at kaydash.za.net Sat Jul 23 15:30:49 2005 From: korpse-ironpython at kaydash.za.net (Jonathan Jacobs) Date: Sat, 23 Jul 2005 15:30:49 +0200 Subject: [IronPython] Issues with "exec X in Y" Message-ID: <42E24689.8080300@kaydash.za.net> Me again, I ran across a couple of issues using the above syntax. I usually use it when making use of "config" files which are just Python source files: config = {} exec file('config.py') in config del config['__builtins__'] 1.) Specifying locals or globals broke things. As far as I can tell this is because the CodeGen.emitCall call (called from ExecStmt.Emit) was being asked to find a method that took two objects of type "object", instead of two objects of type "object" and type "IDictionary", respectively, of which there are none. 2.) The "exec" statement didn't deal with file objects at all. I'm not sure whether anybody is aware of these, so I'm not sure if they've already been taken care of. I've attached a patch to address these issues. My patch however doesn't add a "__builtins__" key to the mappable types, so the above code would actually error out in IronPython with my patch, so someone probably wants to add that. In order to make my life easier, I also implemented the "name" property on file objects. Hopefully this helps someone. -- Jonathan -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: exec-in.patch URL: From metawilm at gmail.com Sun Jul 24 11:39:22 2005 From: metawilm at gmail.com (Willem Broekema) Date: Sun, 24 Jul 2005 11:39:22 +0200 Subject: [IronPython] Issues with "exec X in Y" In-Reply-To: <42E24689.8080300@kaydash.za.net> References: <42E24689.8080300@kaydash.za.net> Message-ID: On 7/23/05, Jonathan Jacobs wrote: > config = {} > exec file('config.py') in config > del config['__builtins__'] > [...] > My patch however doesn't add a "__builtins__" key to the > mappable types, so the above code would actually error out in IronPython > with my patch, so someone probably wants to add that. No, your code relies on an implementation detail. A Python implementation may add any key, like __builtins__, to the dictionary, but is not at all required to. Your code should check for the existence of the key before deleting it. There are cases where the difference between Python-the-language and CPython-the-implementation is not clear, but in this case it's explicitly documented in : As a side effect, an implementation may insert additional keys into the dictionaries given besides those corresponding to variable names set by the executed code. For example, the current implementation may add a reference to the dictionary of the built-in module __builtin__ under the key __builtins__ (!). - Willem From mailinglist.account at gmail.com Mon Jul 25 13:40:51 2005 From: mailinglist.account at gmail.com (Anthony Tarlano) Date: Mon, 25 Jul 2005 13:40:51 +0200 Subject: [IronPython] Pondering Monad/MSH and IronPython Message-ID: Hi, I just downloaded "Monad" the MSH shell, watched Jeffery Snover's vision behind Monad and played with the app. After looking at the MSH shell briefly, the big question that popped into my head is what's the big picture game plan for IronPython and Monad? Both IronPython and MSH have interpreted language and syntax to take advantage of .NET reflection and access to the properties of the objects. Both allow object scripting, composition, etc. So, the question is, Why have both? If MSH is focused at introspective system programming scenarios, then why not just use IronPython? If IronPython is focused at higher level developers, then why have MSH as the introspection facility for Visual Studio as was insinuated from Jeffery Snover's vision behind Monad? I don't know if this is the forum for these questions, but it would be good to know where each tools focus will be. Thanks, Anthony -------------- next part -------------- An HTML attachment was scrubbed... URL: From kfarmer at thuban.org Mon Jul 25 18:14:36 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Mon, 25 Jul 2005 09:14:36 -0700 Subject: [IronPython] Pondering Monad/MSH and IronPython Message-ID: I think it has to do with syntax, and the DSL tools push. MSH in particular is geared toward one-liner pipelines, whereas Python is a little heavy-weight in that regard. MSH is also intended to be somewhat familiar to those from the *sh world. Remember one of the selling points of .NET was that people could use the language they want for the task. In particular, that means that people can use the most appropriate language for the task. MS is pushing domain-specific language tools, and MSH can be seen as that - its language consists of drives, folders, files, and how to process and present lists and streams thereof in a one-line syntax. Python, on the other hand, strikes me as much more suited for general applications work. If it were a matter of reducing languages, I'd expect MS to just push the existing .NET implementations of VBS and JS, and possibly purchase the rights to one of the C# script engines. Just my observations... ----- Keith J. Farmer kfarmer at thuban.org ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Anthony Tarlano Sent: Monday, 25 July 2005 04:41 So, the question is, Why have both? If MSH is focused at introspective system programming scenarios, then why not just use IronPython? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jlam at iunknown.com Mon Jul 25 18:21:14 2005 From: jlam at iunknown.com (John Lam) Date: Mon, 25 Jul 2005 12:21:14 -0400 Subject: [IronPython] Pondering Monad/MSH and IronPython Message-ID: <1E66B509DC78F74BA1CC22C625B096D1E10C@dc.iunknown.com> On the other hand, it's useful to avoid context switches to get things done. For example, we recently tossed NAnt out of our build/deploy environment and replaced it with Ruby+Rake. In NAnt, the context switch from "scripting a task" to "writing a task" was really severe - you had to pull out your compiler to get something done. In Ruby+Rake, we now seemlessly migrate back and forth between sending commands to the shell, to writing abstractions to do certain things (like config our NLBS cluster) to writing descriptions like "this target depends on these three other targets". I haven't had a chance to look at the MSH language yet - apparently something is keeping my betaplace application from being accepted (or my spam filter is eating the reply - not sure :)) but for those who have seen it, can python or ruby-isms produce more or less the syntax? -John http://www.iunknown.com ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Keith J. Farmer Sent: Mon 7/25/2005 12:14 PM To: Discussion of IronPython Subject: RE: [IronPython] Pondering Monad/MSH and IronPython I think it has to do with syntax, and the DSL tools push. MSH in particular is geared toward one-liner pipelines, whereas Python is a little heavy-weight in that regard. MSH is also intended to be somewhat familiar to those from the *sh world. Remember one of the selling points of .NET was that people could use the language they want for the task. In particular, that means that people can use the most appropriate language for the task. MS is pushing domain-specific language tools, and MSH can be seen as that - its language consists of drives, folders, files, and how to process and present lists and streams thereof in a one-line syntax. Python, on the other hand, strikes me as much more suited for general applications work. If it were a matter of reducing languages, I'd expect MS to just push the existing .NET implementations of VBS and JS, and possibly purchase the rights to one of the C# script engines. Just my observations... ----- Keith J. Farmer kfarmer at thuban.org ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Anthony Tarlano Sent: Monday, 25 July 2005 04:41 So, the question is, Why have both? If MSH is focused at introspective system programming scenarios, then why not just use IronPython? -------------- next part -------------- An HTML attachment was scrubbed... URL: From hank at prosysplus.com Mon Jul 25 19:48:54 2005 From: hank at prosysplus.com (Hank Fay) Date: Mon, 25 Jul 2005 13:48:54 -0400 Subject: [IronPython] Pondering Monad/MSH and IronPython In-Reply-To: <1E66B509DC78F74BA1CC22C625B096D1E10C@dc.iunknown.com> Message-ID: <88585711CC354D8AADB653A6FA1542.MAI@prosysplus.com> Python is capable of functional programming that would make most APLers happy: see David Mertz's articles at http://www-128.ibm.com/developerworks/linux/library/l-prog.html and http://www-128.ibm.com/developerworks/linux/library/l-prog2.html, although Ruby was there earlier with closures, according to Mertz. Hank _____ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of John Lam Sent: Monday, July 25, 2005 12:21 PM To: Discussion of IronPython; Discussion of IronPython Subject: RE: [IronPython] Pondering Monad/MSH and IronPython On the other hand, it's useful to avoid context switches to get things done. For example, we recently tossed NAnt out of our build/deploy environment and replaced it with Ruby+Rake. In NAnt, the context switch from "scripting a task" to "writing a task" was really severe - you had to pull out your compiler to get something done. In Ruby+Rake, we now seemlessly migrate back and forth between sending commands to the shell, to writing abstractions to do certain things (like config our NLBS cluster) to writing descriptions like "this target depends on these three other targets". I haven't had a chance to look at the MSH language yet - apparently something is keeping my betaplace application from being accepted (or my spam filter is eating the reply - not sure :)) but for those who have seen it, can python or ruby-isms produce more or less the syntax? -John http://www.iunknown.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From kfarmer at thuban.org Mon Jul 25 19:50:51 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Mon, 25 Jul 2005 10:50:51 -0700 Subject: [IronPython] Pondering Monad/MSH and IronPython Message-ID: I haven't used Ruby, but my experience with Python would say the syntaxes are very different. In particular, I don't know of syntax in Python that says: * "Take a stream, apply lambda to each element, and send the output to a stream." * "Attach the output of this stream to the input of this other stream." The streams may be stdIn, stdOut, errOut, objIn, and objOut, more or less. It's the last two that MSH focuses on. In the Unix world, tradition has us parsing stdin and sending stuff to stdout (an attempt to be lenient) whereas MSH abandons the custom parsing in favor of streams of objects (an attempt to be precise). Formatting and parsing happen only when absolutely necessary, such as when you write a parser to convert the lines in a file into objects (leniently creating precision), or at the end of execution, when you can optionally specify that the output is to be a list, or a table, or some other format you create a definition for such as an Email Format. I think this pipeline is fairly key to MSH's identity. MSH is fairly much a shell/language bundle, where Python is a language with an external shell to it. As Python is often seen as the glue between platform modules, I think you could see MSH as the glue between scripts. You *could* make a new shell that used Python as a base language, and introduced the pipeline syntax; I think it'd be interesting to see someone make a generic shell that could take a plug-in compiler. In any case, you will be able to extend MSH with functions you create in IronPython, once (I think) IronPython has attributes and static compilation available. If you do so, I think you'll make make Mono users very happy. The MSH Wiki is here.. there's some documentation to be found here, as well as in the team blogs. I'd definitely recommend the latter, particularly http://www.proudlyserving.com/, which has a 5-part series on Monad and RSS starting 25 June, which touches on many of the bits. Of course, these are my views. I'm no language-design expert. ;) ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of John Lam Sent: Mon 7/25/2005 9:21 AM I haven't had a chance to look at the MSH language yet - apparently something is keeping my betaplace application from being accepted (or my spam filter is eating the reply - not sure :)) but for those who have seen it, can python or ruby-isms produce more or less the syntax? -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 6048 bytes Desc: not available URL: From shidan at gmail.com Mon Jul 25 20:22:07 2005 From: shidan at gmail.com (Shidan) Date: Mon, 25 Jul 2005 11:22:07 -0700 Subject: [IronPython] Pondering Monad/MSH and IronPython In-Reply-To: <88585711CC354D8AADB653A6FA1542.MAI@prosysplus.com> References: <1E66B509DC78F74BA1CC22C625B096D1E10C@dc.iunknown.com> <88585711CC354D8AADB653A6FA1542.MAI@prosysplus.com> Message-ID: <429b380e0507251122172a4bf4@mail.gmail.com> It's capable of functional programming, somewhat, but it is highly discouraged, from what I hear lambda, reduce, map and most other higher order functions will be deprecated in Python 3. On 7/25/05, Hank Fay wrote: > > Python is capable of functional programming that would make most APLers > happy: see David Mertz's articles at > http://www-128.ibm.com/developerworks/linux/library/l-prog.html > and > http://www-128.ibm.com/developerworks/linux/library/l-prog2.html, > although Ruby was there earlier with closures, according to Mertz. > > Hank > > > > ________________________________ > From: users-ironpython.com-bounces at lists.ironpython.com > [mailto:users-ironpython.com-bounces at lists.ironpython.com] > On Behalf Of John Lam > Sent: Monday, July 25, 2005 12:21 PM > To: Discussion of IronPython; Discussion of IronPython > Subject: RE: [IronPython] Pondering Monad/MSH and IronPython > > > > On the other hand, it's useful to avoid context switches to get things done. > For example, we recently tossed NAnt out of our build/deploy environment and > replaced it with Ruby+Rake. In NAnt, the context switch from "scripting a > task" to "writing a task" was really severe - you had to pull out your > compiler to get something done. In Ruby+Rake, we now seemlessly migrate back > and forth between sending commands to the shell, to writing abstractions to > do certain things (like config our NLBS cluster) to writing descriptions > like "this target depends on these three other targets". > > I haven't had a chance to look at the MSH language yet - apparently > something is keeping my betaplace application from being accepted (or my > spam filter is eating the reply - not sure :)) but for those who have seen > it, can python or ruby-isms produce more or less the syntax? > > -John > http://www.iunknown.com > > _______________________________________________ > users-ironpython.com mailing list > users-ironpython.com at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > From luismg at gmx.net Mon Jul 25 22:44:53 2005 From: luismg at gmx.net (Luis M. Gonzalez) Date: Mon, 25 Jul 2005 17:44:53 -0300 Subject: [IronPython] Version 1.0? Message-ID: <000601c59159$b7db8120$1302a8c0@luis> Hi Martin, I read the announcement and, with this description: http://conferences.oreillynet.com/cs/os2005/view/e_sess/6862 I assume you'll get version 1.0 ready for the conference. Is that right? Luis -------------- next part -------------- An HTML attachment was scrubbed... URL: From ken.manheimer at gmail.com Mon Jul 25 22:58:26 2005 From: ken.manheimer at gmail.com (Ken Manheimer) Date: Mon, 25 Jul 2005 16:58:26 -0400 Subject: [IronPython] Pondering Monad/MSH and IronPython In-Reply-To: References: Message-ID: <2cd46e7f050725135870ecd8f9@mail.gmail.com> On 7/25/05, Keith J. Farmer wrote: > [...] > In the Unix world, tradition has us parsing stdin and sending stuff to > stdout (an attempt to be lenient) whereas MSH abandons the custom parsing > in favor of streams of objects (an attempt to be precise). Formatting > and parsing happen only when absolutely necessary, such as when you write > a parser to convert the lines in a file into objects (leniently creating > precision), or at the end of execution, when you can optionally specify > that the output is to be a list, or a table, or some other format you > create a definition for such as an Email Format. I think this pipeline > is fairly key to MSH's identity. i haven't yet seen the language, but the sound of it is quite exciting. > MSH is fairly much a shell/language bundle, where Python is a language > with an external shell to it. As Python is often seen as the glue > between platform modules, I think you could see MSH as the glue between > scripts. > > You *could* make a new shell that used Python as a base language, and > introduced the pipeline syntax; I think it'd be interesting to see > someone make a generic shell that could take a plug-in compiler. In any > case, you will be able to extend MSH with functions you create in > IronPython, once (I think) IronPython has attributes and static > compilation available. If you do so, I think you'll make make Mono users > very happy. i seem to recall someone who used overloading on bitwise-or to provide pipeline-style activity in expressions. yeah - there it is - http://lbss.math.msu.su/~krikun/PipeSyntaxModule . far from ideal, however - you have to define an __ror__ special method for each class you want to use on a pipeline. as an enthusiastic sh scripter, and with the addition of generator expressions, it's enticing to think about heading down this path. but ultimately i think it may be too much of a stretch - sees like there's a fundamental impedence mismatch between the way you want to connect things together in a command shell and the way you connect things together in a procedural language. then again, it might have seemed that way in general until someone came up with the filter/pipelines model, eg in bourne shell... > The MSH Wiki is here.. there's some documentation to be found here, as > well as in the team blogs. I'd definitely recommend the latter, > particularly http://www.proudlyserving.com/, which has a 5-part series on > Monad and RSS starting 25 June, which touches on many of the bits. thanks for the leads! > Of course, these are my views. I'm no language-design expert. ;) me, too.-) -- Ken Manheimer From kfarmer at thuban.org Mon Jul 25 23:02:06 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Mon, 25 Jul 2005 14:02:06 -0700 Subject: [IronPython] Pondering Monad/MSH and IronPython Message-ID: It's pretty cool. I'm not entirely warmed up to the language part of MSH, but then it's been a while since I was big on batch files, but it's very powerful. A buddy and I have been talking the last hour or so about how to extend the power by allowing multiple named output streams. This could allow you to, for example, sort a list of numbers into various buckets for binning, or more interestingly, take an input stream of mixed objects, and dispatch to various different streams for processing, according to object type. You'd need a way to apply namespaces to the names, of course, but I think you could implement much of the integration patterns in Fowler. Someone needs to write a queue provider for MSH, but that's for a different list. -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3420 bytes Desc: not available URL: From kfarmer at thuban.org Mon Jul 25 23:13:43 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Mon, 25 Jul 2005 14:13:43 -0700 Subject: [IronPython] Pondering Monad/MSH and IronPython Message-ID: (We've secretely replaced Keith's AP English training with a demented chimp.. Let's see if anyone notices.) ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Keith J. Farmer Sent: Mon 7/25/2005 2:02 PM To: Discussion of IronPython Subject: RE: [IronPython] Pondering Monad/MSH and IronPython [...] but then it's [...] but it's very powerful. -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 3468 bytes Desc: not available URL: From brian at zope.com Tue Jul 26 05:40:27 2005 From: brian at zope.com (Brian Lloyd) Date: Mon, 25 Jul 2005 23:40:27 -0400 Subject: [IronPython] IP & Python for .NET 2.0 roadmap Message-ID: <20050726034030.584CE3B805C@smtp.zope.com> Hi all - sorry to cross-post to the IP list, but I know there are some folks who follow both projects and might want a head's up -- please post any replies to the pythondotnet list unless it really is pertinent to IP per se. I'm about to wrap up development on Python for .NET and make a 1.0 release, and wanted to post a roadmap for 2.0. The next (and hopefully last) RC release of 1.0 will include a few changes to make out/ref param behavior compatible with IronPython, followed by a final 1.0 release. The Roadmap: Python for .NET 1.x will be targeted to the .NET 1.x runtime. It will not be terribly compatible with any code developed for IronPython. Python for .NET 2.x will be targeted to the .NET 2.x runtime, and Python code for it will be as compatible as possible with the IronPython runtime. Meaning, I hope that Python code that runs on pythonnet 2.x will run without changes on IronPython. Generally, I think all of us are excited to see the sustained effort being applied to IronPython. Having a code-compatible 'CLR consumer' implementation based on CPython should be helpful not only in providing an upgrade path for the future for users of pythonnet but also provide some interesting possibilities for comparative conformance and performance testing, test sharing, etc. Proposed changes for 2.0 (mostly related to IP compatibility): - Support for 'son of sys.LoadAssemblyByName' As noted on the IP mailing list, Jim doesn't like the current sys.LoadAssemblyByName solution (http://lists.ironpython.com/pipermail/users-ironpython.com/2005-July/000805 .html) I mostly tend to agree - at any rate, I'd like for pythonnet to support whatever the successor is. (Some suggestions maybe in another thread) - API compatibility with the IP PythonEngine I'd like the pythonnet PythonEngine to support the API of the IP engine, to make it at least possible to swap back and forth with a minimum of effort. The current pythonnet PythonEngine API would be deprecated (but available) until 3.0. A probable breaking change here is that pythonnet requires managed code to be aware of the GIL -- IP seems to have gotten rid of that requirement (hooray!). The gist is that it would be nice if embedders writing in C#, VB or other less-dynamic managed code could swap back and forth with no more than some namespace futzing if possible. - Support syntax for resolution of generic types, methods and overload resolution IP has (or soon will have) introduced some spelling to support instantiation of generic types and fine resolution of overloaded methods. It should be no problem to support the spellings that have so far been proposed: # instantiate a generic type from System.Collections.Generic import List x = List[str]() # realized generic type as first class object c = List[str] # open generic types as objects -- not sure yet how this would # or wouldn't relate to IP plans o = List # pinpoint overloads -- note that we would allow the use of # python types to indicate CLR types in these limited cases # a la IP (str == System.String, int == System.Int32, etc.) Console.WriteLine[str]("Hi") Console.WriteLine[int](6) - Leverage LCG in the runtime There are a few places that could benefit from LCG -- this is a 'nice to have', since we'll already benefit from some of the CLR 2.x improvements to caching of reflected members, etc. - Import spelling This is probably the most controversial and potentially breaking change for users of Python for .NET 1.x. PythonNet currently uses a top level 'CLR' module to contain all modules (namespaces) imported from the CLR. For 2.x, I would propose killing this in favor of the the direct spelling used by IP (import System.Console vs. import CLR.System.Console). This will have some effect on performance, but I think it will be \ manageable. If at all possible, I'd like to arrange for the CLR.xxx spelling to remain supported (but deprecated) until 3.0, unless it would really kill perf. Note that all of these changes are focused on the 'CLR consumer' aspect of Python. I don't know of any public designs for IP as a CLR producer (and having CPython act as a producer introduces a whole new world of problems), so at this point I'm only looking at compatibility from a consumer perspective. generic-'ly, Brian Lloyd brian at zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com From martmaly at exchange.microsoft.com Tue Jul 26 05:50:27 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Mon, 25 Jul 2005 20:50:27 -0700 Subject: [IronPython] Version 1.0? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE4C2C8C@DF-BANDIT-MSG.exchange.corp.microsoft.com> Unfortunately, no. We will not have version 1.0 for the conference. The plan is still the same as it was about a month ago when we outlined the roadmap towards the 0.8 release. Martin ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Luis M. Gonzalez Sent: Monday, July 25, 2005 1:45 PM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] Version 1.0? Hi Martin, I read the announcement and, with this description: http://conferences.oreillynet.com/cs/os2005/view/e_sess/6862 I assume you'll get version 1.0 ready for the conference. Is that right? Luis -------------- next part -------------- An HTML attachment was scrubbed... URL: From kfarmer at thuban.org Tue Jul 26 06:47:52 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Mon, 25 Jul 2005 21:47:52 -0700 Subject: [IronPython] Version 1.0? Message-ID: I recall, way-back-when, that 2-week release cycles were planned. What are things looking like now? ----- Keith J. Farmer kfarmer at thuban.org ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Martin Maly Sent: Monday, 25 July 2005 20:50 To: Discussion of IronPython Subject: RE: [IronPython] Version 1.0? Unfortunately, no. We will not have version 1.0 for the conference. The plan is still the same as it was about a month ago when we outlined the roadmap towards the 0.8 release. -------------- next part -------------- An HTML attachment was scrubbed... URL: From monty at inaugust.com Tue Jul 26 20:58:36 2005 From: monty at inaugust.com (Monty Taylor) Date: Tue, 26 Jul 2005 11:58:36 -0700 (PDT) Subject: [IronPython] IP & Python for .NET 2.0 roadmap In-Reply-To: <20050726034030.584CE3B805C@smtp.zope.com> References: <20050726034030.584CE3B805C@smtp.zope.com> Message-ID: <49515.167.88.200.30.1122404316.squirrel@167.88.200.30> Hi Brian, Would you consider Python for .NET ready enough to use as a conduit between Zope and .NET in a production environment? I'm currently working on a Zope app that lives in a .NET world and I think this would help me stem the tide of people who want to rewrite it in C#. Thanks! Monty From martmaly at exchange.microsoft.com Tue Jul 26 23:41:32 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Tue, 26 Jul 2005 14:41:32 -0700 Subject: [IronPython] Version 1.0? Message-ID: <1DFB396200705E46B5338CA4B2E25BDE51FC5C@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi Keith, very fair question and yes, you are correct saying that we had planned for 2-week release cycle. Until the last release (0.7.6) we were actually true to our plan to release every two weeks. We did expect the next release to take longer than the usual two weeks (as we announced in the email little over a month ago). The longer delay is being caused mainly by the extent of the code changes we have been making and the preparation for the OsCon 2005 conference. That said, we are not making the delay our habit and we hope that the next release will be worth the wait. Martin ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Keith J. Farmer Sent: Monday, July 25, 2005 9:48 PM To: Discussion of IronPython Subject: RE: [IronPython] Version 1.0? I recall, way-back-when, that 2-week release cycles were planned. What are things looking like now? ----- Keith J. Farmer kfarmer at thuban.org ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Martin Maly Sent: Monday, 25 July 2005 20:50 To: Discussion of IronPython Subject: RE: [IronPython] Version 1.0? Unfortunately, no. We will not have version 1.0 for the conference. The plan is still the same as it was about a month ago when we outlined the roadmap towards the 0.8 release. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kfarmer at thuban.org Wed Jul 27 00:14:26 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Tue, 26 Jul 2005 15:14:26 -0700 Subject: [IronPython] Version 1.0? Message-ID: I'm sure it will ;) I'm starting to think of some winfx projects to apply IP and MSH to. I'm assuming the planned release is OsCon -- what can we look forward to? ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Martin Maly Sent: Tue 7/26/2005 2:41 PM very fair question and yes, you are correct saying that we had planned for 2-week release cycle. Until the last release (0.7.6) we were actually true to our plan to release every two weeks. We did expect the next release to take longer than the usual two weeks (as we announced in the email little over a month ago). The longer delay is being caused mainly by the extent of the code changes we have been making and the preparation for the OsCon 2005 conference. That said, we are not making the delay our habit and we hope that the next release will be worth the wait. -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 5042 bytes Desc: not available URL: