From kfarmer at thuban.org Thu Sep 1 01:11:55 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Wed, 31 Aug 2005 16:11:55 -0700 Subject: [IronPython] RE: Numpy port Message-ID: It's okay to interchange 'i' and 'y' .. so you can go through each combination of i/y that occurs in each part. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Thane Sent: Wed 8/31/2005 2:00 PM To: 'Discussion of IronPython' Subject: RE: [IronPython] RE: Numpy port essential_parts = "py,pyth,python".split(',') other_parts = "net,i,ir,iron,fe,ferrous,-anything-but-sharp-".split(',') for part1 in essential_parts: for part2 in other_parts: print part1+part2 print part2+part1 (Doesn't include "Pyronic" which I kinda like.) -------------- next part -------------- A non-text attachment was scrubbed... Name: winmail.dat Type: application/ms-tnef Size: 5632 bytes Desc: not available URL: From jvm_cop at spamcop.net Thu Sep 1 04:24:09 2005 From: jvm_cop at spamcop.net (J. Merrill) Date: Wed, 31 Aug 2005 22:24:09 -0400 Subject: [IronPython] RE: Numpy port In-Reply-To: Message-ID: <4.3.2.7.2.20050831222319.05999b98@mail.comcast.net> Oh good -- we can program in "pithy" !!! At 07:11 PM 8/31/2005, Keith J. Farmer wrote >It's okay to interchange 'i' and 'y' .. so you can go through each combination of i/y that occurs in each part. >_______________________________ > >From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Thane >Sent: Wed 8/31/2005 2:00 PM >To: 'Discussion of IronPython' >Subject: RE: [IronPython] RE: Numpy port > >essential_parts = "py,pyth,python".split(',') >other_parts = "net,i,ir,iron,fe,ferrous,-anything-but-sharp-".split(',') >for part1 in essential_parts: > for part2 in other_parts: > print part1+part2 > print part2+part1 > >(Doesn't include "Pyronic" which I kinda like.) J. Merrill / Analytical Software Corp From msurel at comcast.net Thu Sep 1 20:32:37 2005 From: msurel at comcast.net (msurel at comcast.net) Date: Thu, 01 Sep 2005 18:32:37 +0000 Subject: [IronPython] RE: Numpy port Message-ID: <090120051832.19331.431749450008F1DA00004B832200761438040A9D9A9C03@comcast.net> I was thinking 'pynt'. If you wrote a light version of the interpreter you could call it 'half-pynt'. > Oh good -- we can program in "pithy" !!! > > At 07:11 PM 8/31/2005, Keith J. Farmer wrote > >It's okay to interchange 'i' and 'y' .. so you can go through each combination > of i/y that occurs in each part. > >_______________________________ > > > >From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Thane > >Sent: Wed 8/31/2005 2:00 PM > >To: 'Discussion of IronPython' > >Subject: RE: [IronPython] RE: Numpy port > > > >essential_parts = "py,pyth,python".split(',') > >other_parts = "net,i,ir,iron,fe,ferrous,-anything-but-sharp-".split(',') > >for part1 in essential_parts: > > for part2 in other_parts: > > print part1+part2 > > print part2+part1 > > > >(Doesn't include "Pyronic" which I kinda like.) > > > J. Merrill / Analytical Software Corp > > _______________________________________________ > 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 Thu Sep 1 22:50:28 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Thu, 1 Sep 2005 13:50:28 -0700 Subject: [IronPython] Debugger scripted with IronPython Message-ID: <1DFB396200705E46B5338CA4B2E25BDE7A450C@DF-BANDIT-MSG.exchange.corp.microsoft.com> A colleague of mine published two interesting articles on his blog yesterday. He embedded IronPython in the managed debugger (mdbg) and made the debugger scriptable. First blog describes how to use the modified debugger: http://blogs.msdn.com/jmstall/archive/2005/08/31/Mdbg_Python_ext.aspx Second goes into technical details of embedding IronPython in the application: http://blogs.msdn.com/jmstall/archive/2005/09/01/Howto_embed_ironpython. aspx Since we had several embedding related discussions on the alias recently I thought I'd point you to Mike Stall's articles. Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From rayfd_2000 at yahoo.com Fri Sep 2 10:08:13 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Fri, 2 Sep 2005 01:08:13 -0700 (PDT) Subject: [IronPython] Iron Python language compliance In-Reply-To: <20050901190236.5AADB1C0A3@che.dreamhost.com> Message-ID: <20050902080813.49640.qmail@web30708.mail.mud.yahoo.com> Hello, I wonder, what's the targeted CPython version compliance when Iron Python is released? Is it 2.4? So we'll have generators and stuff? Thanks, Ray __________________________________ Yahoo! Mail Stay connected, organized, and protected. Take the tour: http://tour.mail.yahoo.com/mailtour.html From info at geatec.com Fri Sep 2 16:18:03 2005 From: info at geatec.com (J. de Hooge) Date: Fri, 2 Sep 2005 16:18:03 +0200 Subject: [IronPython] self not known in lambda function Message-ID: <000001c5afc9$25009690$6402a8c0@GEADELL> # Hi, # # Might this be a small bug in IronPython? 'self' is not known inside the definition of a lambda function # I tried to insulate the problem in a small (admittedly pointless) program, not to bother you with bulky app. code # I am using IronPython 0.9.1 # # Kind regards # Jacques de Hooge info at geatec.com # # This example will print the following: # ====================================== # # workaround # Traceback (most recent call last): # at __main__.Initialize() in C:\activ_dell\prog\fun\src\funDebug.py:line 29 # at __main__.lamda$1$f5() # NameError: name 'self' not defined # # ====================================== class WorkAround: def __init__ (self): global this this = self self.setPrintWithoutParams (lambda: this.printWithParams ('workaround')) def printWithParams (self, text): print text def setPrintWithoutParams (self, printWithoutParams): self.printWithoutParams = printWithoutParams workAround = WorkAround () workAround.printWithoutParams () class Problem: def __init__ (self): self.setPrintWithoutParams (lambda: self.printWithParams ('problem')) def printWithParams (self, text): print text def setPrintWithoutParams (self, printWithoutParams): self.printWithoutParams = printWithoutParams problem = Problem () problem.printWithoutParams () -------------- next part -------------- An HTML attachment was scrubbed... URL: From martmaly at exchange.microsoft.com Fri Sep 2 16:55:33 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Fri, 2 Sep 2005 07:55:33 -0700 Subject: [IronPython] Iron Python language compliance In-Reply-To: <20050902080813.49640.qmail@web30708.mail.mud.yahoo.com> References: <20050901190236.5AADB1C0A3@che.dreamhost.com>, <20050902080813.49640.qmail@web30708.mail.mud.yahoo.com> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE212F65@DF-BANDIT-MSG.exchange.corp.microsoft.com> We already have generators, but yes. for 1.0 we are tragetting 2.4 compatibility (I may even implement few of the 2.5 upcoming features such as the new 'with' statement). Martin ________________________________________ From: Ray Djajadinata Sent: 9/2/2005 1:08 AM To: users-ironpython.com at lists.ironpython.com Cc: Subject: [IronPython] Iron Python language compliance Hello, I wonder, what's the targeted CPython version compliance when Iron Python is released? Is it 2.4? So we'll have generators and stuff? Thanks, Ray __________________________________ Yahoo! Mail Stay connected, organized, and protected. Take the tour: http://tour.mail.yahoo.com/mailtour.html _______________________________________________ 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 monty at inaugust.com Fri Sep 2 18:26:34 2005 From: monty at inaugust.com (Monty Taylor) Date: Fri, 2 Sep 2005 09:26:34 -0700 (PDT) Subject: [IronPython] Iron Python language compliance In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE212F65@DF-BANDIT-MSG.exchange.corp.mi crosoft.com> References: <20050901190236.5AADB1C0A3@che.dreamhost.com>, <20050902080813.49640.qmail@web30708.mail.mud.yahoo.com> <1DFB396200705E46B5338CA4B2E25BDE212F65@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: <37612.167.88.200.30.1125678394.squirrel@167.88.200.30> Do they have a list up somewhere of what's accepted for 2.5? I looked on the PEP page and there is no 2.5 release schedule up. Monty > We already have generators, but yes. for 1.0 we are tragetting 2.4 > compatibility (I may even implement few of the 2.5 upcoming features such > as the new 'with' statement). > > Martin > > ________________________________________ > From: Ray Djajadinata > Sent: 9/2/2005 1:08 AM > To: users-ironpython.com at lists.ironpython.com > Cc: > Subject: [IronPython] Iron Python language compliance > > Hello, > > I wonder, what's the targeted CPython version > compliance when Iron Python is released? Is it 2.4? So > we'll have generators and stuff? > > Thanks, > Ray > > > > __________________________________ > Yahoo! Mail > Stay connected, organized, and protected. Take the tour: > http://tour.mail.yahoo.com/mailtour.html > > _______________________________________________ > 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 martmaly at exchange.microsoft.com Fri Sep 2 19:51:08 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Fri, 2 Sep 2005 10:51:08 -0700 Subject: [IronPython] Iron Python language compliance In-Reply-To: <37612.167.88.200.30.1125678394.squirrel@167.88.200.30> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE7A4774@DF-BANDIT-MSG.exchange.corp.microsoft.com> I know of the 'with' statement from Guido's presentation at Oscon. Other than that, I haven't seen detailed release schedule for 2.5 either so I am only going with the PEPs that have been accepted (342, 343). Martin -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Monty Taylor Sent: Friday, September 02, 2005 9:27 AM To: Discussion of IronPython Cc: users-ironpython.com at lists.ironpython.com Subject: RE: [IronPython] Iron Python language compliance Do they have a list up somewhere of what's accepted for 2.5? I looked on the PEP page and there is no 2.5 release schedule up. Monty > We already have generators, but yes. for 1.0 we are tragetting 2.4 > compatibility (I may even implement few of the 2.5 upcoming features > such as the new 'with' statement). > > Martin > > ________________________________________ > From: Ray Djajadinata > Sent: 9/2/2005 1:08 AM > To: users-ironpython.com at lists.ironpython.com > Cc: > Subject: [IronPython] Iron Python language compliance > > Hello, > > I wonder, what's the targeted CPython version compliance when Iron > Python is released? Is it 2.4? So we'll have generators and stuff? > > Thanks, > Ray > > > > __________________________________ > Yahoo! Mail > Stay connected, organized, and protected. Take the tour: > http://tour.mail.yahoo.com/mailtour.html > > _______________________________________________ > 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 > _______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From rayfd_2000 at yahoo.com Fri Sep 2 20:11:51 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Fri, 2 Sep 2005 11:11:51 -0700 (PDT) Subject: [IronPython] Iron Python language compliance In-Reply-To: <20050902145922.908A11BD81@che.dreamhost.com> Message-ID: <20050902181151.74784.qmail@web30711.mail.mud.yahoo.com> > We already have generators, but yes. for 1.0 we are > tragetting 2.4 compatibility (I may even implement > few of the 2.5 upcoming features such as the new > 'with' statement). That is way cool, Martin. Thanks! Regards, Ray > > Martin ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs From riltim at gmail.com Fri Sep 2 20:36:29 2005 From: riltim at gmail.com (Tim Riley) Date: Fri, 2 Sep 2005 14:36:29 -0400 Subject: [IronPython] Debugger scripted with IronPython In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE7A450C@DF-BANDIT-MSG.exchange.corp.microsoft.com> References: <1DFB396200705E46B5338CA4B2E25BDE7A450C@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: Martin: Thank you for the links. They will be very useful to me for a future project. Tim On 9/1/05, Martin Maly wrote: > > A colleague of mine published two interesting articles on his blog > yesterday. He embedded IronPython in the managed debugger (mdbg) and made > the debugger scriptable. > > First blog describes how to use the modified debugger: > > http://blogs.msdn.com/jmstall/archive/2005/08/31/Mdbg_Python_ext.aspx > > Second goes into technical details of embedding IronPython in the > application: > > > http://blogs.msdn.com/jmstall/archive/2005/09/01/Howto_embed_ironpython.aspx > > Since we had several embedding related discussions on the alias recently > I thought I'd point you to Mike Stall's articles. > > Martin > > _______________________________________________ > 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 Fri Sep 2 23:10:43 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Fri, 2 Sep 2005 14:10:43 -0700 Subject: [IronPython] More IronPython, embedding and debugging Message-ID: <1DFB396200705E46B5338CA4B2E25BDE7A4859@DF-BANDIT-MSG.exchange.corp.microsoft.com> This time from Shawn, another colleague of mine http://blogs.msdn.com/shawnfa/archive/2005/09/02/460216.aspx Martin From hank at prosysplus.com Fri Sep 2 23:55:38 2005 From: hank at prosysplus.com (Hank Fay) Date: Fri, 2 Sep 2005 17:55:38 -0400 Subject: [IronPython] More IronPython, embedding and debugging In-Reply-To: <1DFB396200705E46B5338CA4B2E25BDE7A4859@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: <500BE2B845D49129CC69643EA65.MAI@prosysplus.com> This is incredibly neat stuff, Martin. In the "what I miss in .Net" department, do you have any colleagues who play in the .Net IDE area? Creating a builder to change the class of a control on a design surface, including moving properties and doing other intelligent code, is about 25 lines in my current environment (getting the live object of the design surface to play with is two lines). Embedding IP into the IDE would likely be the first step to fixing this hole, and since you seem to have some pretty cool colleagues... Hank Fay From martmaly at exchange.microsoft.com Sat Sep 3 02:27:57 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Fri, 2 Sep 2005 17:27:57 -0700 Subject: [IronPython] IronPython 0.9.1 released In-Reply-To: Message-ID: <1DFB396200705E46B5338CA4B2E25BDE7A491E@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi Keith, sorry for the long time it took to respond, > Keith J. Farmer Wrote: > ILMerge, or GAC? We are not installing IronPython in the GAC yet because of the stage of development we are in. I am guessing that once we hit 1.0, the bits could easily live in GAC. > Out of curiosity, is there going to be the equivalent of pyw, > or some switch to tell IronPython to generate a GUI app, rather than a console app? I certainly hope so :) Martin From martmaly at exchange.microsoft.com Sat Sep 3 02:46:38 2005 From: martmaly at exchange.microsoft.com (Martin Maly) Date: Fri, 2 Sep 2005 17:46:38 -0700 Subject: [IronPython] Memory leak in PythonEngine.Evaluate ? In-Reply-To: <4314B44B.3010804@softwaremind.pl> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE7A4925@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi Szymon, I believe I haven't yet responded to your questions. Sorry for the delay. > First I iterated the Embed1 sample 10 000 times. Unfortunately this resulted > in big increase in memory allocation (from 10K to >100K confirmed both in Task > Manager and with perfmon). I started looking at PythonEngine implementation > and it looks that although I can create its instance all calls are redirected > to a static global object. This doesn't "smells" nice. This does not necessarily have to be a bad sign. The Evaluate method ends up parsing the expression, generating code and then executing it. There is no smart caching in place that would detect repetitive expressions and reuse the code. Either way, the memory is garbage collected (including the generated code) so when the time comes (it depends on many variables garbage collector monitors when that time comes) memory will get collected. Pre-compiling the expression certainly helps as you have observed and I think that adding Compile method (equivalent to built-in compile function) on the PythonEngine is a good idea. > So I wonder what happens in the PythonEngine that makes this huge memory loss? > Another question is, why Expr.Evaluate() is marked as "experimental" and if it > is safe to use it? Good question. As part of the performance boosts, it may make sense to evaluate expression rather than parse/generage code/execute for certain kinds of expressions. This code is not currently used (Options.FastEval is set to false) so from that perspective there may be some bugs in the fast eval code path that we have not discovered yet. I hope this helps Martin From Martin.Maly at microsoft.com Wed Sep 7 05:01:08 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Tue, 6 Sep 2005 20:01:08 -0700 Subject: [IronPython] self not known in lambda function In-Reply-To: <000001c5afc9$25009690$6402a8c0@GEADELL> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE7A4D10@DF-BANDIT-MSG.exchange.corp.microsoft.com> Thanks for he repro and bug report, Jacques, the bug you see is caused by missing implementation of closures in IronPython. The closure implementation is on our to-do list. Thanks! Martin ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of J. de Hooge Sent: Friday, September 02, 2005 7:18 AM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] self not known in lambda function # Hi, # # Might this be a small bug in IronPython? 'self' is not known inside the definition of a lambda function # I tried to insulate the problem in a small (admittedly pointless) program, not to bother you with bulky app. code # I am using IronPython 0.9.1 # <# Kind regards # Jacques de Hooge info at geatec.com # # This example will print the following: # ====================================== # # workaround # Traceback (most recent call last): # at __main__.Initialize() in C:\activ_dell\prog\fun\src\funDebug.py:line 29 # at __main__.lamda$1$f5() # NameError: name 'self' not defined # # ====================================== class WorkAround: def __init__ (self): global this this = self self.setPrintWithoutParams (lambda: this.printWithParams ('workaround')) def printWithParams (self, text): print text def setPrintWithoutParams (self, printWithoutParams): self.printWithoutParams = printWithoutParams workAround = WorkAround () workAround.printWithoutParams () class Problem: def __init__ (self): self.setPrintWithoutParams (lambda: self.printWithParams ('problem')) def printWithParams (self, text): print text def setPrintWithoutParams (self, printWithoutParams): self.printWithoutParams = printWithoutParams problem = Problem () problem.printWithoutParams () -------------- next part -------------- An HTML attachment was scrubbed... URL: From cpu.crazy at gmail.com Mon Sep 12 02:50:35 2005 From: cpu.crazy at gmail.com (Joseph Quigley) Date: Sun, 11 Sep 2005 18:50:35 -0600 Subject: [IronPython] IronPython for *NIX? In-Reply-To: References: Message-ID: <4324D0DB.8040901@gmail.com> Are there any plans for IronPython coming out on the *NIX platforms? Of course it won't support the .NET stuff, but what about the MONO? From lloyd at nova-mind.com Mon Sep 12 03:18:36 2005 From: lloyd at nova-mind.com (Lloyd Dupont) Date: Mon, 12 Sep 2005 11:18:36 +1000 Subject: [IronPython] IronPython for *NIX? References: <4324D0DB.8040901@gmail.com> Message-ID: <00ca01c5b737$e76bc090$9800a8c0@PC1> Miguel Icaza play happily with IronPython as far as I know ;-) ----- Original Message ----- From: "Joseph Quigley" To: Sent: Monday, September 12, 2005 10:50 AM Subject: [IronPython] IronPython for *NIX? > Are there any plans for IronPython coming out on the *NIX platforms? > Of course it won't support the .NET stuff, but what about the MONO? > _______________________________________________ > 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 Mon Sep 12 07:08:58 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Sun, 11 Sep 2005 22:08:58 -0700 Subject: [IronPython] IronPython for *NIX? Message-ID: The release notes for the latest drop of Mono (1.9.0) says it runs IronPython 0.9 (0.9.1 as well, perhaps?), with some caveats regarding the unit tests. ----- Keith J. Farmer // kfarmer at thuban.org -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Lloyd Dupont Miguel Icaza play happily with IronPython as far as I know ;-) From wolfgang.keller.nospam at gmx.de Mon Sep 12 18:24:58 2005 From: wolfgang.keller.nospam at gmx.de (Wolfgang Keller) Date: Mon, 12 Sep 2005 18:24:58 +0200 Subject: [IronPython] IronPython on Windows CE.net? Message-ID: <515778812.20050912182458@gmx.de> Hello, as I currently don't have such a device at my own disposition, I would like to ask here whether anyone has already tried to run IronPython on Windows CE.net, which runs e.g. on the industrial PDAs made by Psion Teklogix. If not, is there anyone who has at least an idea how likely Ironpython is to run (reasonably well) on such a "compact" platform? TIA, Sincerely, Wolfgang Keller -- P.S.: My From-address is correct From sriramk at gmail.com Tue Sep 13 15:32:16 2005 From: sriramk at gmail.com (Sriram Krishnan) Date: Tue, 13 Sep 2005 19:02:16 +0530 Subject: [IronPython] IronPython on Windows CE.net? In-Reply-To: <515778812.20050912182458@gmx.de> References: <515778812.20050912182458@gmx.de> Message-ID: Interesting - IronPython would need to work on the .Net Compact Framework to run on Windows Mobile phones and PocketPcs. Off the top of my head, I don't think NetCF supports the reflection magic that IronPython uses - but I could be wrong Sriram On 9/12/05, Wolfgang Keller wrote: > Hello, > > as I currently don't have such a device at my own disposition, I would > like to ask here whether anyone has already tried to run IronPython on > Windows CE.net, which runs e.g. on the industrial PDAs made by Psion > Teklogix. > > If not, is there anyone who has at least an idea how likely Ironpython > is to run (reasonably well) on such a "compact" platform? > > TIA, > > Sincerely, > > Wolfgang Keller > > -- > P.S.: My From-address is correct > > > _______________________________________________ > users-ironpython.com mailing list > users-ironpython.com at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From matti.haavikko at futurice.fi Fri Sep 16 10:43:24 2005 From: matti.haavikko at futurice.fi (Matti Haavikko) Date: Fri, 16 Sep 2005 11:43:24 +0300 Subject: [IronPython] IronPython on Windows CE.net? In-Reply-To: References: <515778812.20050912182458@gmx.de> Message-ID: <432A85AC.7070808@futurice.fi> Hi, Just to let you know: there are a lot of potential users for Python on mobile devices. I would be really interested in using IronPython on .net compact framework. Initially, we would use IronPython for fast prototyping, experimentation and demo projects, and later for production software. - Haavikko Sriram Krishnan wrote: >Interesting - IronPython would need to work on the .Net Compact >Framework to run on Windows Mobile phones and PocketPcs. > >Off the top of my head, I don't think NetCF supports the reflection >magic that IronPython uses - but I could be wrong > >Sriram > >On 9/12/05, Wolfgang Keller wrote: > > >>Hello, >> >>as I currently don't have such a device at my own disposition, I would >>like to ask here whether anyone has already tried to run IronPython on >>Windows CE.net, which runs e.g. on the industrial PDAs made by Psion >>Teklogix. >> >>If not, is there anyone who has at least an idea how likely Ironpython >>is to run (reasonably well) on such a "compact" platform? >> >>TIA, >> >>Sincerely, >> >>Wolfgang Keller >> >>-- >>P.S.: My From-address is correct >> >> >>_______________________________________________ >>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 rayfd_2000 at yahoo.com Sun Sep 18 18:56:02 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Sun, 18 Sep 2005 09:56:02 -0700 (PDT) Subject: [IronPython] Why won't these snippets run? In-Reply-To: <20050916190421.888AA1BCBD@che.dreamhost.com> Message-ID: <20050918165602.33752.qmail@web30711.mail.mud.yahoo.com> Hello, I'm using Iron Python 0.9.1. I wonder why won't these run? fileBeforeSort = file("READ_ME_AND_SORT_ME.txt", "r") afterSort = sorted(int(line.rstrip('\n')) for line in fileBeforeSort) fileBeforeSort.close() IronPython tripped on the 2nd line, it said: SyntaxError: unexpected token for at ReadAndSortAndWriteInPython.py:2 Also, when I tried to use Python to write what is basically a C# program: from System import Array, Convert from System.IO import File reader = File.OpenText("READ_ME_AND_SORT_ME.txt") beforeSort = reader.ReadToEnd().Split('\n') reader.Close() beforeSortInt = [Convert.ToInt32(number) for number in beforeSort] Array.Sort(beforeSortInt) Also, if I use parentheses during conversion like this: beforeSortInt = (Convert.ToInt32(number) for number in beforeSort) IronPython will choke: Traceback (most recent call last): SyntaxError: unexpected token for at ReadAndSortAndWriteInPython2.py:8 I managed to make that disappear by turning the parentheses into square brackets, but then I got this: D:\Development\Book>IronPythonConsole ReadAndSortAndWriteInPython2.py Traceback (most recent call last): at __main__.Initialize() in D:\Development\Book\ReadAndSortAndWriteInPython2. py:line 12 ValueError: Bad args for the method OK, so beforeSortInt is a Python list, whereas Array.Sort expects a System.Array, but... shouldn't this translate transparently? Or am I missing something real silly here? Thanks a bunch, Ray __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From Martin.Maly at microsoft.com Mon Sep 19 04:54:48 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Sun, 18 Sep 2005 19:54:48 -0700 Subject: [IronPython] Why won't these snippets run? In-Reply-To: <20050918165602.33752.qmail@web30711.mail.mud.yahoo.com> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE89B03E@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi Ray, > Ray Djajadinata Wrote: > > fileBeforeSort = file("READ_ME_AND_SORT_ME.txt", "r") > afterSort = sorted(int(line.rstrip('\n')) for line in fileBeforeSort) > fileBeforeSort.close() > > IronPython tripped on the 2nd line, it said: > > SyntaxError: unexpected token for at > ReadAndSortAndWriteInPython.py:2 > This code uses generator expressions which IronPython doesn't support yet. It is Python 2.4 feature and we are just starting to add 2.4 features Into IronPython. I am hoping to add the support for generator expressions soon. > Also, when I tried to use Python to write what is basically a > C# program: > > > from System import Array, Convert > from System.IO import File > > reader = File.OpenText("READ_ME_AND_SORT_ME.txt") > beforeSort = reader.ReadToEnd().Split('\n') > reader.Close() > > beforeSortInt = [Convert.ToInt32(number) for number in beforeSort] > > Array.Sort(beforeSortInt) > I don't see reason for this to not work, what error are you getting? > Also, if I use parentheses during conversion like this: > > beforeSortInt = (Convert.ToInt32(number) for number in beforeSort) Again, this doesn't work because of the missing enerator expressions. > I managed to make that disappear by turning the parentheses > into square brackets, but then I got this: > > D:\Development\Book>IronPythonConsole > ReadAndSortAndWriteInPython2.py > > Traceback (most recent call last): > at __main__.Initialize() in > D:\Development\Book\ReadAndSortAndWriteInPython2. > py:line 12 > ValueError: Bad args for the method > > OK, so beforeSortInt is a Python list, whereas Array.Sort > expects a System.Array, but... shouldn't this translate > transparently? Or am I missing something real silly here? That's exactly the reason why it doesn't work. Python lists don't Translate to .NET arrays automatically. I hope this is something we'll fix soon. Martin From rayfd_2000 at yahoo.com Mon Sep 19 09:11:50 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Mon, 19 Sep 2005 00:11:50 -0700 (PDT) Subject: [IronPython] Re: Why won't these snippets run? In-Reply-To: <20050918190402.925441BBA2@che.dreamhost.com> Message-ID: <20050919071151.82948.qmail@web30703.mail.mud.yahoo.com> Hi Martin! Thanks! I think last time you mentioned that IP already had generators--were you referring to 0.9.2 or some other version in the future? Also... regarding the Array, is there any workaround? I tried this: from System import Array, Convert, Int32 pyList = [9, 7, 8, 4, 6, 3, 6, 8, 4, 1] toBeSorted = Array.CreateInstance(GetType(Int32), len(pyList)) for index, item in enumerate(pyList): toBeSorted.SetValue(item, index) Array.Sort(toBeSorted) but I got this: Traceback (most recent call last): at __main__.Initialize() in C:\temp\workaround.py:line 5 System.InvalidCastException: Object cannot be stored in an array of this type. Cheers Ray ______________________________________________________ Yahoo! for Good Donate to the Hurricane Katrina relief effort. http://store.yahoo.com/redcross-donate3/ From fredrik at pythonware.com Mon Sep 19 13:38:04 2005 From: fredrik at pythonware.com (Fredrik Lundh) Date: Mon, 19 Sep 2005 13:38:04 +0200 Subject: [IronPython] Re: Why won't these snippets run? References: <20050918190402.925441BBA2@che.dreamhost.com> <20050919071151.82948.qmail@web30703.mail.mud.yahoo.com> Message-ID: Ray Djajadinata wrote: > Thanks! I think last time you mentioned that IP > already had generators--were you referring to 0.9.2 or > some other version in the future? "generators" != "generator expressions" the former is an execution mechanism which lets a function or method incrementally "yield" a sequence of values, instead of returning a single value (introduced in Python 2.2); the latter is syntactic sugar for one- line generators (introduced in Python 2.4). From Martin.Maly at microsoft.com Mon Sep 19 17:45:14 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Mon, 19 Sep 2005 08:45:14 -0700 Subject: [IronPython] Re: Why won't these snippets run? In-Reply-To: <20050919071151.82948.qmail@web30703.mail.mud.yahoo.com> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE89B088@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi Ray, Fredrik already asnwered your generator expression related question. As for the arrays, Here is solution that seems to work: >>> from System import * >>> a = Array.CreateInstance(Int32, 10) >>> a System.Int32[](0, 0, 0, 0, 0, 0, 0, 0, 0, 0) >>> r = range(10) >>> for i in r: a[i] = i >>> a System.Int32[](0, 1, 2, 3, 4, 5, 6, 7, 8, 9) I tried your code snippet, but couldn't identify what the GetType function was. I hope this helps. Again, it is not a perfect solution and it is one of many items on our to-do list to make Python built-in types and .Net types play better together. Martin > -----Original Message----- > From: users-ironpython.com-bounces at lists.ironpython.com > [mailto:users-ironpython.com-bounces at lists.ironpython.com] On > Behalf Of Ray Djajadinata > Sent: Monday, September 19, 2005 12:12 AM > To: users-ironpython.com at lists.ironpython.com > Subject: [IronPython] Re: Why won't these snippets run? > > Hi Martin! > > Thanks! I think last time you mentioned that IP already had > generators--were you referring to 0.9.2 or some other version > in the future? > > Also... regarding the Array, is there any workaround? > I tried this: > > from System import Array, Convert, Int32 pyList = [9, 7, 8, > 4, 6, 3, 6, 8, 4, 1] toBeSorted = Array.CreateInstance(GetType(Int32), > len(pyList)) > for index, item in enumerate(pyList): > toBeSorted.SetValue(item, index) > Array.Sort(toBeSorted) > > but I got this: > > Traceback (most recent call last): > at __main__.Initialize() in > C:\temp\workaround.py:line 5 > System.InvalidCastException: Object cannot be stored in an > array of this type. > > Cheers > Ray From rayfd_2000 at yahoo.com Mon Sep 19 18:27:06 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Mon, 19 Sep 2005 09:27:06 -0700 (PDT) Subject: [IronPython] Re: Why won't these snippets run? In-Reply-To: <20050918190402.925441BBA2@che.dreamhost.com> Message-ID: <20050919162706.81460.qmail@web30710.mail.mud.yahoo.com> Hi Martin, Thanks, you spotted the source of the problem. When I removed GetType() from around Int32, my solution works: from System import Array, Convert, Int32 pyList = [9, 7, 8, 4, 6, 3, 6, 8, 4, 1] toBeSorted = Array.CreateInstance(Int32, len(pyList)) for index, item in enumerate(pyList): toBeSorted.SetValue(item, index) Array.Sort(toBeSorted) GetType() is a curious thing. It is an operator in VB.NET, which probably got into my snippet from copying the sample for Array.CreateInstance from the .NET SDK documentation somewhere. There wasn't any NameError while running the script though? In VB.NET, it returns the Type object for the specified type, so it should return the Type object for Int32 in this case. However, when I did this in my script: print GetType(Int32) print GetType the output was: IronPython.Objects.OpsReflectedType Strange. Since it is an operator in VB, IP shouldn't even recognize it! Thanks again, Ray Hi Ray, Fredrik already asnwered your generator expression related question. As for the arrays, Here is solution that seems to work: >>> from System import * >>> a = Array.CreateInstance(Int32, 10) >>> a System.Int32[](0, 0, 0, 0, 0, 0, 0, 0, 0, 0) >>> r = range(10) >>> for i in r: a[i] = i >>> a System.Int32[](0, 1, 2, 3, 4, 5, 6, 7, 8, 9) I tried your code snippet, but couldn't identify what the GetType function was. I hope this helps. Again, it is not a perfect solution and it is one of many items on our to-do list to make Python built-in types and .Net types play better together. Martin __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From rayfd_2000 at yahoo.com Mon Sep 19 18:28:34 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Mon, 19 Sep 2005 09:28:34 -0700 (PDT) Subject: [IronPython] Re: Why won't these snippets run? In-Reply-To: <20050918190402.925441BBA2@che.dreamhost.com> Message-ID: <20050919162835.62405.qmail@web30705.mail.mud.yahoo.com> Thanks for the clarification, Fredrik! Cheers, Ray "generators" != "generator expressions" the former is an execution mechanism which lets a function or method incrementally "yield" a sequence of values, instead of returning a single value (introduced in Python 2.2); the latter is syntactic sugar for one- line generators (introduced in Python 2.4). __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com From Martin.Maly at microsoft.com Mon Sep 19 18:55:43 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Mon, 19 Sep 2005 09:55:43 -0700 Subject: [IronPython] Re: Why won't these snippets run? In-Reply-To: <20050919162706.81460.qmail@web30710.mail.mud.yahoo.com> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE89B0E3@DF-BANDIT-MSG.exchange.corp.microsoft.com> I must have mistyped the GetType function the first time around because IronPython would find it otherwise. The IronPython's logic to look-up built-in methods finds the method GetType on the __builtin__ class implementation. I don't have solution for this yet, but at least we understand what is going on :) Thanks! Martin > Ray Djajadinata Wrote: > > Hi Martin, > > Thanks, you spotted the source of the problem. When I removed > GetType() from around Int32, my solution > works: > > > from System import Array, Convert, Int32 > > pyList = [9, 7, 8, 4, 6, 3, 6, 8, 4, 1] > toBeSorted = Array.CreateInstance(Int32, len(pyList)) for > index, item in enumerate(pyList): > toBeSorted.SetValue(item, index) > Array.Sort(toBeSorted) > > > GetType() is a curious thing. It is an operator in VB.NET, > which probably got into my snippet from copying the sample > for Array.CreateInstance from the .NET SDK documentation > somewhere. There wasn't any NameError while running the script though? > > In VB.NET, it returns the Type object for the specified type, > so it should return the Type object for Int32 in this case. > However, when I did this in my > script: > > print GetType(Int32) > print GetType > > the output was: > > IronPython.Objects.OpsReflectedType > > > Strange. Since it is an operator in VB, IP shouldn't even > recognize it! > > Thanks again, > Ray From kfarmer at thuban.org Mon Sep 19 21:43:26 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Mon, 19 Sep 2005 12:43:26 -0700 Subject: [IronPython] Extension methods... Message-ID: All the fun Linq bits run on beta 2. All that's needed is a way to make use of extension method attributes, which is remarkably Pythonic: foo.Bar(baz) -> Gleep.Bar(foo, baz). Python already has lambdas, but could use a means to generate expression trees rather than functions. From thane at magna-capital.com Tue Sep 20 17:23:02 2005 From: thane at magna-capital.com (Thane) Date: Tue, 20 Sep 2005 11:23:02 -0400 Subject: [IronPython] Extension methods... In-Reply-To: Message-ID: <20050920152318.851CA1BB38@che.dreamhost.com> LINQ is pretty cool -- thanks for the update Keith. I do find it amusing that many of these "queries" are available in standard Python through list comprehensions, lambda, etc. Here's a simple LINQ example: [Category("Restriction Operators")] [Title("Where - Simple 1")] [Description("This sample uses where to find all elements of an array less than 5.")] public void Linq1() { int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var lowNums = from n in numbers where n < 5 select n; Console.WriteLine("Numbers < 5:"); foreach (var x in lowNums) { Console.WriteLine(x); } } Here's the Python equivalent: >>> numbers = [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] >>> lownums = [n for n in numbers if n < 5] >>> lownums [4, 1, 3, 2, 0] >>> For most simple extractions of this sort, I prefer the Python list comprehension. IMO, the power of LINQ comes from integrating to databases using the same syntax as you would for other IEnumerable objects. > -----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: Monday, September 19, 2005 3:43 PM > To: users-ironpython.com at lists.ironpython.com > Subject: [IronPython] Extension methods... > > All the fun Linq bits run on beta 2. All that's needed is a way to make > use of extension method attributes, which is remarkably Pythonic: > foo.Bar(baz) -> Gleep.Bar(foo, baz). Python already has lambdas, but > could use a means to generate expression trees rather than functions. > > > _______________________________________________ > 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 Tue Sep 20 18:38:21 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Tue, 20 Sep 2005 09:38:21 -0700 Subject: [IronPython] Extension methods... Message-ID: LINQ is *very* simple. It's simply, as Anders puts it, a pattern for describing queries. It's made useful by way of extension methods and the compiler deciding to convert a lambda expression not into a delegate, but into an expression tree. The query methods (Where, OrderBy, Select, etc) take trees, and build up a description of the query which is then evaluated only when enumerated. This allows DLINQ, for example, to analyze the tree and produce a SQL command to send to a database, or XLINQ to produce an XQuery expression, or LINQ to just take it as-is. If you'd used a list comprehension, you'd end up pulling all the information down from the database (were this a database table); since this is an expression that can be analyzed, you can manipulate it before it's actually invoked. You can conceivably take the expression and ship it whole to some service, for the service to deal with. Were this a CLR host (such as Yukon), you'd have, effectively, created a remoted procedure. Thus, it's *not* the same as a Python comprehension. The syntax could be similar, but the compiler would decide what to do based on whether the method in question takes a Func<> or an Expression<>. So I would say you were close, but not quite accurate. Take a few passes through the spec -- it's much more interesting than it seems at first. ----- Keith J. Farmer // kfarmer at thuban.org -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Thane Sent: Tuesday, 20 September 2005 08:23 Here's the Python equivalent: >>> numbers = [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] >>> lownums = [n for n in numbers if n < 5] >>> lownums [4, 1, 3, 2, 0] >>> For most simple extractions of this sort, I prefer the Python list comprehension. IMO, the power of LINQ comes from integrating to databases using the same syntax as you would for other IEnumerable objects. From lattam at mac.com Tue Sep 20 18:47:16 2005 From: lattam at mac.com (Michael Latta) Date: Tue, 20 Sep 2005 09:47:16 -0700 Subject: [IronPython] Extension methods... In-Reply-To: Message-ID: <200509201647.j8KGlQ8m021195@mac.com> Keith, Your summary of LINQ is correct in technical details. I believe that the comment was about preferred syntax. The same could be done for Python, by allowing the list comprehension syntax to be used to produce expression trees not just executable blocks. This was the main thing I liked about LINQ. The language features to support it were not custom to that usage, but could be used in other contexts. Defining what Python specific compiler/language features would yield the same flexibility is what caught my attention. At the run-time level interop would be useful, but at the syntax level something that is more "Pythonish" would be nice. Michael -----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: Tuesday, September 20, 2005 9:38 AM To: thane at magna-capital.com; Discussion of IronPython Subject: RE: [IronPython] Extension methods... LINQ is *very* simple. It's simply, as Anders puts it, a pattern for describing queries. It's made useful by way of extension methods and the compiler deciding to convert a lambda expression not into a delegate, but into an expression tree. The query methods (Where, OrderBy, Select, etc) take trees, and build up a description of the query which is then evaluated only when enumerated. This allows DLINQ, for example, to analyze the tree and produce a SQL command to send to a database, or XLINQ to produce an XQuery expression, or LINQ to just take it as-is. If you'd used a list comprehension, you'd end up pulling all the information down from the database (were this a database table); since this is an expression that can be analyzed, you can manipulate it before it's actually invoked. You can conceivably take the expression and ship it whole to some service, for the service to deal with. Were this a CLR host (such as Yukon), you'd have, effectively, created a remoted procedure. Thus, it's *not* the same as a Python comprehension. The syntax could be similar, but the compiler would decide what to do based on whether the method in question takes a Func<> or an Expression<>. So I would say you were close, but not quite accurate. Take a few passes through the spec -- it's much more interesting than it seems at first. ----- Keith J. Farmer // kfarmer at thuban.org -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Thane Sent: Tuesday, 20 September 2005 08:23 Here's the Python equivalent: >>> numbers = [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] >>> lownums = [n for n in numbers if n < 5] >>> lownums [4, 1, 3, 2, 0] >>> For most simple extractions of this sort, I prefer the Python list comprehension. IMO, the power of LINQ comes from integrating to databases using the same syntax as you would for other IEnumerable objects. _______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From thane at magna-capital.com Tue Sep 20 19:26:10 2005 From: thane at magna-capital.com (Thane) Date: Tue, 20 Sep 2005 13:26:10 -0400 Subject: [IronPython] Extension methods... In-Reply-To: <200509201647.j8KGlQ8m021195@mac.com> Message-ID: <20050920172612.7AE321BB13@che.dreamhost.com> Yes, Michael, preferred syntax was the point of the examples. Although this may simply be a case of "I'm familiar with Python syntax and I'm not familiar with LINQ", there is a greater similarity between the Python list comprehension and SQL syntax. This makes it easy to jump between the SQL data domain and the Python code domain. It is interesting that this is one of the goals of LINQ: to seamlessly integrate these domains. Admittedly, Anders is right when he says that in SQL "the scope of the variable flow is backwards". It is. I like the fact that using "from-where-select" allows statement completion (this is a BIG plus for compilers), while the SQL equivalent of "select-from-where" does not permit this. --Thane > -----Original Message----- > From: Michael Latta [mailto:lattam at mac.com] > Sent: Tuesday, September 20, 2005 12:47 PM > To: 'Discussion of IronPython'; thane at magna-capital.com > Subject: RE: [IronPython] Extension methods... > > Keith, > Your summary of LINQ is correct in technical details. I believe that the > comment was about preferred syntax. The same could be done for Python, by > allowing the list comprehension syntax to be used to produce expression > trees not just executable blocks. This was the main thing I liked about > LINQ. The language features to support it were not custom to that usage, > but could be used in other contexts. Defining what Python specific > compiler/language features would yield the same flexibility is what caught > my attention. At the run-time level interop would be useful, but at the > syntax level something that is more "Pythonish" would be nice. > > Michael > > -----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: Tuesday, September 20, 2005 9:38 AM > To: thane at magna-capital.com; Discussion of IronPython > Subject: RE: [IronPython] Extension methods... > > LINQ is *very* simple. It's simply, as Anders puts it, a pattern for > describing queries. It's made useful by way of extension methods and > the compiler deciding to convert a lambda expression not into a > delegate, but into an expression tree. > The query methods (Where, OrderBy, Select, etc) take trees, and build up > a description of the query which is then evaluated only when enumerated. > This allows DLINQ, for example, to analyze the tree and produce a SQL > command to send to a database, or XLINQ to produce an XQuery expression, > or LINQ to just take it as-is. If you'd used a list comprehension, > you'd end up pulling all the information down from the database (were > this a database table); since this is an expression that can be > analyzed, you can manipulate it before it's actually invoked. > You can conceivably take the expression and ship it whole to some > service, for the service to deal with. Were this a CLR host (such as > Yukon), you'd have, effectively, created a remoted procedure. > Thus, it's *not* the same as a Python comprehension. The syntax could > be similar, but the compiler would decide what to do based on whether > the method in question takes a Func<> or an Expression<>. > So I would say you were close, but not quite accurate. Take a few > passes through the spec -- it's much more interesting than it seems at > first. > ----- > Keith J. Farmer // kfarmer at thuban.org > > -----Original Message----- > From: users-ironpython.com-bounces at lists.ironpython.com > [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of > Thane > Sent: Tuesday, 20 September 2005 08:23 > > Here's the Python equivalent: > > >>> numbers = [5, 4, 1, 3, 9, 8, 6, 7, 2, 0] > >>> lownums = [n for n in numbers if n < 5] > >>> lownums > [4, 1, 3, 2, 0] > >>> > > For most simple extractions of this sort, I prefer the Python list > comprehension. IMO, the power of LINQ comes from integrating to > databases > using the same syntax as you would for other IEnumerable objects. > > _______________________________________________ > 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 Tue Sep 20 19:33:51 2005 From: kfarmer at thuban.org (Keith J. Farmer) Date: Tue, 20 Sep 2005 10:33:51 -0700 Subject: [IronPython] Extension methods... Message-ID: Right.. it's just a pattern for metaprogramming. The current implementation just has a little bit of compiler assist. There are the underlying extension methods (which are defined in a very Pythonic way: static Foo Bar(this Baz, Gleep)), which can be used directly, or wrapped in sugar. Of course, you don't *have* to have extension methods -- they just allow for mix-ins (more Python) so we can avoid writing the same code for every IEnumerable<> in the system. I think the interesting bit for us, now, is that all this runs on the 2.0 runtime. From what I can tell, all it'd take would be some compiler modifications to recognize extension methods (marked by attribute) and to create an easy way to create expression trees, and IronPython would be set for it. Yes, I'm excited about LINQ.. I've seen many gems come out of .NET (and a few blunders). This, I think, is just plain beautiful. ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com on behalf of Michael Latta Sent: Tue 9/20/2005 9:47 AM To: 'Discussion of IronPython'; thane at magna-capital.com Subject: RE: [IronPython] Extension methods... Keith, Your summary of LINQ is correct in technical details. I believe that the comment was about preferred syntax. The same could be done for Python, by allowing the list comprehension syntax to be used to produce expression trees not just executable blocks. This was the main thing I liked about LINQ. The language features to support it were not custom to that usage, but could be used in other contexts. Defining what Python specific compiler/language features would yield the same flexibility is what caught my attention. At the run-time level interop would be useful, but at the syntax level something that is more "Pythonish" would be nice. From rayfd_2000 at yahoo.com Thu Sep 22 10:11:07 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Thu, 22 Sep 2005 01:11:07 -0700 (PDT) Subject: [IronPython] Problems in Automating IE with IronPython Message-ID: <20050922081107.87365.qmail@web30709.mail.mud.yahoo.com> Hello, I need to automate IE, but I'm not very familiar with the object model yet, so I want to try out things interactively--hence Python. I can do this using win32 extension for CPython, but there's no auto completion, everything is just a ">". So I thought, hey, IP has auto completion, and I can tlbimp shdocvw.dll, so I can get the best of both worlds. I did exactly that: TlbImp.exe C:\WINDOWS\system32\shdocvw.dll /out:IEDotNet /namespace:IEDotNet and then in IP console: >>> import sys >>> sys.LoadAssemblyFromFile("IEDotNet.dll") >>> from IEDotNet import * >>> ie = InternetExplorerClass() >>> ieApp = ie.Application >>> ieApp.Visible = 1 >>> ieApp.Navigate("http://www.yahoo.com/") (, , , ) >>> doc = ieApp.Document ^C C:\temp> After ieApp.Document, IP hangs there, and I couldn't do anything but to Ctrl+C it. Has anybody ever experienced this before? Thanks, Ray __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com From Martin.Maly at microsoft.com Thu Sep 22 21:04:22 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Thu, 22 Sep 2005 12:04:22 -0700 Subject: [IronPython] IronPython 0.9.2 released Message-ID: <1DFB396200705E46B5338CA4B2E25BDE89BCDD@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hello, We have just released IronPython 0.9.2. In addition to focusing on the CPython regression test suite and fixing bugs, we also spent time prepairing IronPython for PDC 2005 conference where Jim spent the whole of the last week. There were many changes in IronPython codebase, mostly inspired by getting the regression tests running and adding CPython 2.4 features. IronPython 0.9.2 can now run: test_math, test_unary, test_binop, test_fnmatch, test_macpath, test_ntpath, test_operations, test_rfc822, test_urlparse, test_contains, test_augassign, test_call and test_operator without any changes to the tests. Two tests required modifications: test_enumerate - disabled one line in the tuple reuse test that relies on reference counting test_long - part of the test requires closures and few testcases are disabled for bugs. However, we run most of the tests successfully. Thanks to all of you who reported bugs and provided feedback that influenced this release: Anthony Tarlano, Nicholas Jacobson, Erin Renshaw, Vargaz, Pelikhan, Mike Stall, Sdahlbac, Jan Kotas and Mike Hostetler. The larger items in this release are: - implementation of PEP 289: Generator Expressions - implementation of PEP 318: Decorators for Functions and Methods - integer arithmetics fixes that got test_long to work - operator built-in module The full list of bugs fixed can be found below. You can download the new IronPython release from: http://www.microsoft.com/downloads/details.aspx?FamilyID=2c649e9e-cf43-4 1e0-9e22-6e6438924caa&displaylang=en Thanks and keep in touch, The IronPython team List of bugs fixed in IronPython 0.9.2 * Dictionary not supporting initializing with the name=value pairs * generator expressions not implemented * decorators don't work * exec "import sys" throws NullReferenceException * Cannot call eval function with **kwargs * Unary operators ~ - + don't work well on strings and complex numbers * Cannot convert object implementing __float__ to float using float() * Cannot convert long to long * Wrong exception when formatting string with an empty tuple * New style class cannot implement own binary operators * enumerate doesn't have __doc__ string * Wrong exception when enumerator is missing next() method * MoveNext from an IronPython list's enumerator returns error * ReflectOptimizer:GenerateSingleMethod makes calls to abstract methods using OpCodes.Call * No message if deleted var d/n exist * StreamReader in Parser.fromFile should be disposed * test_long: x << n >> n != x for some integers * Python file may throw if not linked to FileStream * test_long.py - oct returned 00L but expected 0L for 0 * test_long.py - Conversion long ==> bool is incorrect * test_long.py - hex returned 0xaaaaaaaaaaaaaaaaL but expected 0xAAAAAAAAAAAAAAAAL for 12297829382473034410 * long("-01L") fails * test_long.py hex(-1L) returns 0xFFFFFFFFFFFFFFFF rather than -0x1 * sys.version_info missing * problem with int and slice (int(" 7 ") fails) * None in 'abc' doesn't raise TypeError * isinstance is not implemented for old class instances * Ops.InPlaceAdd doesn't try to call Add if InPlaceAdd is not supported on the type * Add imp module * Add "update" method on the dictionary * implement operator built-in module * shift by negative number doesn't report error * list or tuple multiplied by zero throws exception * __doc__ not defined on bound old instance methods * __name__ and __module__ missing on OldClass * abs(None) fails with the wrong error * implement operator.attrgetter and operator.itemgetter * NotEqual doesn't call __ne__ * Complex is not comparable data type * operator.*slice methods don't check for integer types * operator.itemgetter throws wrong exception on missing key * Int64 power produces wrong result when overflows to big integers * Right shift does not behave like division for negative numbers (Int32, Int64, integer) * Power to the negative integer throws exception instead of producing Float point results * PowerMod throws ArgumentOutOfRange exception instead of TypeError on exponent < 0 * Optimizer emits duplicate methods for operator (__add__, __radd__) * id() method doesn't produce unique numbers * nt is missing remove() From rayfd_2000 at yahoo.com Fri Sep 23 09:09:43 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Fri, 23 Sep 2005 00:09:43 -0700 (PDT) Subject: [IronPython] RE: Problems in Automating IE with IronPython Message-ID: <20050923070943.27100.qmail@web30709.mail.mud.yahoo.com> Please ignore my earlier post about this, I kinda know what caused the problem now. It seems that when I say this: doc = ieApp.Document IP goes and searches for the type of this thing in the type library--so it didn't really hang, it just took a long time for it to find it and return, seemingly. After I've tlbimp-ed mshtml.tlb and loaded the resulting assembly, the call returns immediately. >>> ieApp.Navigate("http://www.yahoo.com/") (, , , ) >>> doc = ieApp.Document >>> doc ] > >>> Thanks, Ray __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From luismg at gmx.net Fri Sep 23 14:50:31 2005 From: luismg at gmx.net (Luis M. Gonzalez) Date: Fri, 23 Sep 2005 09:50:31 -0300 Subject: [IronPython] bug Message-ID: <001001c5c03d$63c80c80$6600a8c0@luis> Hi Martin, I just wanted to let you know that this strange bug reported om Jun 30 is still ocurring: _____________________________________________________________________________________________ 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 ramdas at developeriq.com Fri Sep 23 17:26:35 2005 From: ramdas at developeriq.com (Ramdas S) Date: Fri, 23 Sep 2005 20:56:35 +0530 Subject: [IronPython] EXE problem Message-ID: <003c01c5c053$3316d4c0$0201a8c0@DIQHOME.COM> This may be an elementary problem. I tried searching the list and did not find an answer. When I try creating exe files from any directory other than /bin, i get this error. How do I create exe files that I can share with others Ramdas Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'IronPython, Version=0.9.2.21401, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'IronPython, Version=0.9.2.21401, Culture=neutral, PublicKeyToken=nul l' WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\M icrosoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure lo gging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus ion!EnableLog]. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Martin.Maly at microsoft.com Fri Sep 23 17:56:20 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Fri, 23 Sep 2005 08:56:20 -0700 Subject: [IronPython] bug In-Reply-To: <001001c5c03d$63c80c80$6600a8c0@luis> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE89BF2B@DF-BANDIT-MSG.exchange.corp.microsoft.com> I did actually look into this and the join works just fine. Problem was, if I remember correctly, that we split the file into different chunks due to newline character handling. It is definitely semantic difference - and therefore a bug - so I intend to fix it. It is just that I was focusing on other pieces of IronPython that I didn't get to it yet. Sorry about that. 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: Friday, September 23, 2005 5:51 AM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] bug Hi Martin, I just wanted to let you know that this strange bug reported om Jun 30 is still ocurring: ________________________________________________________________________ _____________________ 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 Martin.Maly at microsoft.com Fri Sep 23 18:05:25 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Fri, 23 Sep 2005 09:05:25 -0700 Subject: [IronPython] RE: Problems in Automating IE with IronPython In-Reply-To: <20050923070943.27100.qmail@web30709.mail.mud.yahoo.com> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE89BF34@DF-BANDIT-MSG.exchange.corp.microsoft.com> IronPython caches COM interfaces it comes across and when the COM object at hand implements interface that is not in the cache, IP calls method to convert the COM interface into .NET metadata and that takes a long time. Now that you are using the tlbimp-ed version, the interfaces make it to the cache and therefore you see the speed-up. I am glad it works for you now. Martin > -----Original Message----- > From: users-ironpython.com-bounces at lists.ironpython.com > [mailto:users-ironpython.com-bounces at lists.ironpython.com] On > Behalf Of Ray Djajadinata > Sent: Friday, September 23, 2005 12:10 AM > To: users-ironpython.com at lists.ironpython.com > Subject: [IronPython] RE: Problems in Automating IE with IronPython > > Please ignore my earlier post about this, I kinda know what > caused the problem now. It seems that when I say > this: > > doc = ieApp.Document > > IP goes and searches for the type of this thing in the type > library--so it didn't really hang, it just took a long time > for it to find it and return, seemingly. > > After I've tlbimp-ed mshtml.tlb and loaded the resulting > assembly, the call returns immediately. > > >>> ieApp.Navigate("http://www.yahoo.com/") > ( 0x000000000000002B>, ssing object at 0x000000000000002B>, > 00000000002B>, 0x000000000000002B>) > >>> doc = ieApp.Document > >>> doc > 'MSHTML.OldHTMLDocument'>] > > > >>> > > Thanks, > Ray From Martin.Maly at microsoft.com Fri Sep 23 18:14:29 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Fri, 23 Sep 2005 09:14:29 -0700 Subject: [IronPython] EXE problem In-Reply-To: <003c01c5c053$3316d4c0$0201a8c0@DIQHOME.COM> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE89BF3A@DF-BANDIT-MSG.exchange.corp.microsoft.com> For the exes to run, they require the IronPython runtime (IronPython.dll and IronMath.dll). Since we do not install those into the Global Assembly Cache, running the stand-alone exe in the directory that doesn't contain Iron*.dll will fail with the message you are seeing. At this time, generating the exes is more a by-product of IronPython execution rather than full-blown compilation into independent executables. Doing the latter, though, is on our to-do list. It is still a question whether we will get to it before 1.0 release or not. I hope this answers your question Martin ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Ramdas S Sent: Friday, September 23, 2005 8:27 AM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] EXE problem This may be an elementary problem. I tried searching the list and did not find an answer. When I try creating exe files from any directory other than /bin, i get this error. How do I create exe files that I can share with others Ramdas Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'IronPython, Version=0.9.2.21401, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'IronPython, Version=0.9.2.21401, Culture=neutral, PublicKeyToken=nul l' WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\M icrosoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure lo gging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus ion!EnableLog]. From ramdas at developeriq.com Fri Sep 23 18:35:07 2005 From: ramdas at developeriq.com (Ramdas S) Date: Fri, 23 Sep 2005 22:05:07 +0530 Subject: [IronPython] EXE problem References: <1DFB396200705E46B5338CA4B2E25BDE89BF3A@DF-BANDIT-MSG.exchange.corp.microsoft.com> Message-ID: <005101c5c05c$c4c2eb80$0201a8c0@DIQHOME.COM> Thanks. That resolves the problem. I have copied the files into the same destination and it works perfectly Keep up the great work Ramdas ----- Original Message ----- From: "Martin Maly" To: "Discussion of IronPython" Sent: Friday, September 23, 2005 9:44 PM Subject: RE: [IronPython] EXE problem For the exes to run, they require the IronPython runtime (IronPython.dll and IronMath.dll). Since we do not install those into the Global Assembly Cache, running the stand-alone exe in the directory that doesn't contain Iron*.dll will fail with the message you are seeing. At this time, generating the exes is more a by-product of IronPython execution rather than full-blown compilation into independent executables. Doing the latter, though, is on our to-do list. It is still a question whether we will get to it before 1.0 release or not. I hope this answers your question Martin ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Ramdas S Sent: Friday, September 23, 2005 8:27 AM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] EXE problem This may be an elementary problem. I tried searching the list and did not find an answer. When I try creating exe files from any directory other than /bin, i get this error. How do I create exe files that I can share with others Ramdas Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'IronPython, Version=0.9.2.21401, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'IronPython, Version=0.9.2.21401, Culture=neutral, PublicKeyToken=nul l' WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\M icrosoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure lo gging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus ion!EnableLog]. _______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From rayfd_2000 at yahoo.com Sun Sep 25 12:38:40 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Sun, 25 Sep 2005 03:38:40 -0700 (PDT) Subject: [IronPython] Misleading error messages Message-ID: <20050925103840.69018.qmail@web30307.mail.mud.yahoo.com> Hello, I'm playing around with list in IronPython 0.9.2, when I found that error messages regarding the (wrong) number of arguments passed into a function always tells you that the function takes 0 argument: >>> horsemen = ["Pestilence", "War", "Famine", "WebSphere"] >>> horsemen.count() Traceback (most recent call last): at TypeError: count() takes exactly 0 argument (1 given) >>> horsemen.insert(1) Traceback (most recent call last): at TypeError: insert() takes exactly 0 argument (2 given) This happens to built-in function as well: >>> abs() Traceback (most recent call last): at TypeError: abs() takes exactly 0 argument (0 given) This seems to be a problem with .NET Framework 2.0 instead of IP, though. In TypeGen.cs, line 114: MethodBuilder mb = myType.DefineMethod(name, attrs, retType, paramTypes); return new CodeGen(this, mb, mb.GetILGenerator()); In that snippet above, although the paramTypes is a Type[] of length 1 (created using makeArray() in Constant.cs), somehow the MethodBuilder instance that DefineMethod() returns has 0 argument. In the case of abs() above, the property Signature prints: {Name: abs Attributes: 22 Method Signature: Length: 4 Arguments: 0 Signature: 0 0 28 28 0 } I've tried it with .NET Framework 1.1 (just the part about creating the MethodBuilder) and the result is: Length: 4 Arguments: 1 Signature: 0 1 28 28 0 Cheers, Ray __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From rayfd_2000 at yahoo.com Sun Sep 25 15:28:14 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Sun, 25 Sep 2005 06:28:14 -0700 (PDT) Subject: [IronPython] Iterating over Dictionary returns the wrong objects? Message-ID: <20050925132814.10593.qmail@web30301.mail.mud.yahoo.com> Hello, I'm trying to print the contents of a Dictionary. In C# I can do this: foreach (KeyValuePair pair in myDict) { Console.WriteLine(pair.ToString()); } However, in IP, typing this: >>> myDict = Dictionary[int, str]() >>> # ... do stuff here ... >>> for pair in myDict: ... print str(pair) ... or this: >>> for pair in myDict: ... print pair.ToString() ... gives me this: System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry ... Instead of KeyValuePair instances, I was getting DictionaryEntry-s instead, whose ToString() method indeed prints the fully qualified name of the instance (instead of anything meaningful). Is there a workaround or I should just wait for the fix? :) Thank you! Ray __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com From rayfd_2000 at yahoo.com Sun Sep 25 15:49:06 2005 From: rayfd_2000 at yahoo.com (Ray Djajadinata) Date: Sun, 25 Sep 2005 06:49:06 -0700 (PDT) Subject: [IronPython] Iterating over Dictionary returns the wrong objects? Message-ID: <20050925134906.71584.qmail@web30310.mail.mud.yahoo.com> Uh, by workaround, I mean the one that gets me KeyValuePair, not the workaround to print the key and value--one can easily do that with the properties of DictionaryEntry :) Thanks, Ray __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From giammarco.schisani at gmail.com Sun Sep 25 22:54:25 2005 From: giammarco.schisani at gmail.com (Giammarco Schisani) Date: Sun, 25 Sep 2005 21:54:25 +0100 Subject: [IronPython] ASP.NET support Message-ID: Hi there, I was just wondering if it will be possible to write ASP.NET 2.0 applications in IronPython. Thanks! Giammarco -------------- next part -------------- An HTML attachment was scrubbed... URL: From Martin.Maly at microsoft.com Mon Sep 26 18:24:24 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Mon, 26 Sep 2005 09:24:24 -0700 Subject: [IronPython] Misleading error messages In-Reply-To: <20050925103840.69018.qmail@web30307.mail.mud.yahoo.com> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE905E32@DF-BANDIT-MSG.exchange.corp.microsoft.com> The incorrect number of arguments misleading error is a known problem that I haven't had time to fix yet. Martin -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Ray Djajadinata Sent: Sunday, September 25, 2005 3:39 AM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] Misleading error messages Hello, I'm playing around with list in IronPython 0.9.2, when I found that error messages regarding the (wrong) number of arguments passed into a function always tells you that the function takes 0 argument: >>> horsemen = ["Pestilence", "War", "Famine", "WebSphere"] >>> horsemen.count() Traceback (most recent call last): at TypeError: count() takes exactly 0 argument (1 given) >>> horsemen.insert(1) Traceback (most recent call last): at TypeError: insert() takes exactly 0 argument (2 given) This happens to built-in function as well: >>> abs() Traceback (most recent call last): at TypeError: abs() takes exactly 0 argument (0 given) This seems to be a problem with .NET Framework 2.0 instead of IP, though. In TypeGen.cs, line 114: MethodBuilder mb = myType.DefineMethod(name, attrs, retType, paramTypes); return new CodeGen(this, mb, mb.GetILGenerator()); In that snippet above, although the paramTypes is a Type[] of length 1 (created using makeArray() in Constant.cs), somehow the MethodBuilder instance that DefineMethod() returns has 0 argument. In the case of abs() above, the property Signature prints: {Name: abs Attributes: 22 Method Signature: Length: 4 Arguments: 0 Signature: 0 0 28 28 0 } I've tried it with .NET Framework 1.1 (just the part about creating the MethodBuilder) and the result is: Length: 4 Arguments: 1 Signature: 0 1 28 28 0 Cheers, Ray __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Martin.Maly at microsoft.com Mon Sep 26 18:44:00 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Mon, 26 Sep 2005 09:44:00 -0700 Subject: [IronPython] Iterating over Dictionary returns the wrong objects? In-Reply-To: <20050925132814.10593.qmail@web30301.mail.mud.yahoo.com> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE905E44@DF-BANDIT-MSG.exchange.corp.microsoft.com> Hi Ray, With .NET Frameworks Beta 2 the behavior is exactly as you observe, however, I found that your code works as expected on the newest builds of .NET Frameworks, including the Visual Studio Release Candidate build available to MSDN subscribers. Martin -----Original Message----- From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Ray Djajadinata Sent: Sunday, September 25, 2005 6:28 AM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] Iterating over Dictionary returns the wrong objects? Hello, I'm trying to print the contents of a Dictionary. In C# I can do this: foreach (KeyValuePair pair in myDict) { Console.WriteLine(pair.ToString()); } However, in IP, typing this: >>> myDict = Dictionary[int, str]() >>> # ... do stuff here ... >>> for pair in myDict: ... print str(pair) ... or this: >>> for pair in myDict: ... print pair.ToString() ... gives me this: System.Collections.DictionaryEntry System.Collections.DictionaryEntry System.Collections.DictionaryEntry ... Instead of KeyValuePair instances, I was getting DictionaryEntry-s instead, whose ToString() method indeed prints the fully qualified name of the instance (instead of anything meaningful). Is there a workaround or I should just wait for the fix? :) Thank you! Ray __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com _______________________________________________ users-ironpython.com mailing list users-ironpython.com at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sdrucker at microsoft.com Tue Sep 27 02:21:17 2005 From: sdrucker at microsoft.com (Steven Drucker) Date: Mon, 26 Sep 2005 17:21:17 -0700 Subject: [IronPython] Bug in IronPython 0.9.x (0-2) Message-ID: dir does not work correctly for inherited classes. Repro: class foo(): def fooprint(self, b): print(b); class bar(foo): def barprint(self,b): print(b); dir(foo) ['__doc__', 'fooprint'] dir(bar) ['__doc__', 'barprint'] Should be dir(bar) ['__doc__', 'barprint', 'fooprint'] -------------- next part -------------- An HTML attachment was scrubbed... URL: From viola at microsoft.com Tue Sep 27 20:55:45 2005 From: viola at microsoft.com (Paul Viola) Date: Tue, 27 Sep 2005 11:55:45 -0700 Subject: [IronPython] 0.9.2 Message-ID: Turns out that there was a bug in my IRONPYTHONSTARTUP script in the new version (no big deal). The only problem is that when the script failed to run ironpythonconsole does not report an error of any kind. The catch is empty. Thanks, Paul Viola Senior Researcher Microsoft Research -------------- next part -------------- An HTML attachment was scrubbed... URL: From donald_e_hawk at msn.com Sat Sep 24 02:59:05 2005 From: donald_e_hawk at msn.com (Donald Hawk) Date: Fri, 23 Sep 2005 20:59:05 -0400 Subject: [IronPython] WinFX Message-ID: Hello, Related to another download I loaded WinFX which wanted the .NET Framework Version 2 uninstalled. Will IronPython work with WinFX. Donald -------------- next part -------------- An HTML attachment was scrubbed... URL: From Kirk.Olynyk at microsoft.com Sat Sep 24 00:34:22 2005 From: Kirk.Olynyk at microsoft.com (Kirk Olynyk) Date: Fri, 23 Sep 2005 15:34:22 -0700 Subject: [IronPython] Nested Functions Message-ID: <310187D53C02434D8F2CF4CD951B734104092DD1@RED-MSG-60.redmond.corp.microsoft.com> # This works on CPython but not on IronPython 9.2 def f (i): def g (): return i+1 return g() print f(3) -------------- next part -------------- An HTML attachment was scrubbed... URL: From Martin.Maly at microsoft.com Thu Sep 29 03:01:40 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Wed, 28 Sep 2005 18:01:40 -0700 Subject: [IronPython] WinFX In-Reply-To: Message-ID: <1DFB396200705E46B5338CA4B2E25BDE9067FE@DF-BANDIT-MSG.exchange.corp.microsoft.com> Yes, IronPython does work with WinFX. The best combination is .Net 2.0. Beta 2 + WinFX Beta 1 + IronPython 0.9 and newer. The WinFX download page seems somewhat confusing by asking to uninstall previous versions of .NET. At the same time, it says at the bottom of the download page that: " ...This Beta1 release supports Visual Studio 2005 Beta2 and the .NET Framework 2.0 beta" so the way I read it is that you need Beta 2 .Net for WinFX to run. I didn't try WinFX with newer builds of .NET Framworks so I can't confirm whether it works also. Martin ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Donald Hawk Sent: Friday, September 23, 2005 5:59 PM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] WinFX Hello, Related to another download I loaded WinFX which wanted the .NET Framework Version 2 uninstalled. Will IronPython work with WinFX. Donald -------------- next part -------------- An HTML attachment was scrubbed... URL: From Martin.Maly at microsoft.com Thu Sep 29 03:02:59 2005 From: Martin.Maly at microsoft.com (Martin Maly) Date: Wed, 28 Sep 2005 18:02:59 -0700 Subject: [IronPython] Nested Functions In-Reply-To: <310187D53C02434D8F2CF4CD951B734104092DD1@RED-MSG-60.redmond.corp.microsoft.com> Message-ID: <1DFB396200705E46B5338CA4B2E25BDE9067FF@DF-BANDIT-MSG.exchange.corp.microsoft.com> Closures are not yet supported by IronPython. I am fixing this as we speak :) ________________________________ From: users-ironpython.com-bounces at lists.ironpython.com [mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of Kirk Olynyk Sent: Friday, September 23, 2005 3:34 PM To: users-ironpython.com at lists.ironpython.com Subject: [IronPython] Nested Functions # This works on CPython but not on IronPython 9.2 def f (i): def g (): return i+1 return g() print f(3) -------------- next part -------------- An HTML attachment was scrubbed... URL: From mailinglist.account at gmail.com Thu Sep 29 16:44:09 2005 From: mailinglist.account at gmail.com (Anthony Tarlano) Date: Thu, 29 Sep 2005 16:44:09 +0200 Subject: [IronPython] 0.9.2 Module Search Path Error Message-ID: IronPython 0.9.2 is not allowing module import from packages that were previously imported. See below where I could not import from "Synthesis" after importing it from "System.Speech" unless explicitly importing it from "System.Speech.Synthesis". Anthony IronPython 0.9.2 on .NET 2.0.50215.44 Copyright (c) Microsoft Corporation. All rights reserved. >>> import sys >>> sys.LoadAssemblyByName('Speech') >>> from System.Speech import * >>> dir() ['AudioFormat', 'Recognition', 'SpeechManager', 'Synthesis', '_', '__builtins__' , '__doc__', '__name__', 'sys'] >>> from Synthesis import * Traceback (most recent call last): at ImportError: No module named Synthesis >>> dir(Synthesis) ['BookmarkEventArgs', 'FilePrompt', 'InstalledVoice', 'PhonemeEventArgs', 'Promp t', 'PromptBreak', 'PromptBuilder', 'PromptEmphasis', 'PromptEventArgs', 'Prompt Rate', 'PromptStyle', 'PromptVolume', 'SayAs', 'SpeakCompletedEventArgs', 'Speak ProgressEventArgs', 'SpeechSynthesizer', 'SynthesisMediaType', 'SynthesisTextFor mat', 'SynthesizerEmphasis', 'SynthesizerState', 'SynthesizerStateChangedEventAr gs', 'TtsEngine', 'VisemeEventArgs', 'VoiceAge', 'VoiceChangeEventArgs', 'VoiceG ender', 'VoiceInfo'] >>> from Synthesis import * Traceback (most recent call last): at ImportError: No module named Synthesis >>> from System.Speech.Synthesis import * >>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From monty at inaugust.com Thu Sep 29 19:26:11 2005 From: monty at inaugust.com (Monty Taylor) Date: Thu, 29 Sep 2005 10:26:11 -0700 (PDT) Subject: [IronPython] 0.9.2 Module Search Path Error In-Reply-To: References: Message-ID: <23178.167.88.200.30.1128014771.squirrel@167.88.200.30> That doesn't work in CPython either... Python 2.4.1 (#1, May 27 2005, 18:02:40) [GCC 3.3.3 (cygwin special)] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> from xml import * >>> dir() ['__builtins__', '__doc__', '__name__', 'dom', 'parsers', 'sax'] >>> from sax import * Traceback (most recent call last): File "", line 1, in ? ImportError: No module named sax The import statement doesn't work on things in the namespace. It works on things in the module search path. Monty > IronPython 0.9.2 is not allowing module import from packages that were > previously imported. See below where I could not import from "Synthesis" > after importing it from "System.Speech" unless explicitly importing it > from > "System.Speech.Synthesis". > > Anthony > > IronPython 0.9.2 on .NET 2.0.50215.44 > Copyright (c) Microsoft Corporation. All rights reserved. >>>> import sys >>>> sys.LoadAssemblyByName('Speech') >>>> from System.Speech import * >>>> dir() > ['AudioFormat', 'Recognition', 'SpeechManager', 'Synthesis', '_', > '__builtins__' > , '__doc__', '__name__', 'sys'] >>>> from Synthesis import * > Traceback (most recent call last): > at > ImportError: No module named Synthesis >>>> dir(Synthesis) > ['BookmarkEventArgs', 'FilePrompt', 'InstalledVoice', 'PhonemeEventArgs', > 'Promp > t', 'PromptBreak', 'PromptBuilder', 'PromptEmphasis', 'PromptEventArgs', > 'Prompt > Rate', 'PromptStyle', 'PromptVolume', 'SayAs', 'SpeakCompletedEventArgs', > 'Speak > ProgressEventArgs', 'SpeechSynthesizer', 'SynthesisMediaType', > 'SynthesisTextFor > mat', 'SynthesizerEmphasis', 'SynthesizerState', > 'SynthesizerStateChangedEventAr > gs', 'TtsEngine', 'VisemeEventArgs', 'VoiceAge', 'VoiceChangeEventArgs', > 'VoiceG > ender', 'VoiceInfo'] >>>> from Synthesis import * > Traceback (most recent call last): > at > ImportError: No module named Synthesis >>>> from System.Speech.Synthesis import * >>>> > _______________________________________________ > users-ironpython.com mailing list > users-ironpython.com at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From mailinglist.account at gmail.com Thu Sep 29 19:23:55 2005 From: mailinglist.account at gmail.com (Anthony Tarlano) Date: Thu, 29 Sep 2005 19:23:55 +0200 Subject: [IronPython] 0.9.2 Module Search Path Error In-Reply-To: <23178.167.88.200.30.1128014771.squirrel@167.88.200.30> References: <23178.167.88.200.30.1128014771.squirrel@167.88.200.30> Message-ID: Ok, my bad.. Anthony On 9/29/05, Monty Taylor wrote: > > That doesn't work in CPython either... > > Python 2.4.1 (#1, May 27 2005, 18:02:40) > [GCC 3.3.3 (cygwin special)] on cygwin > Type "help", "copyright", "credits" or "license" for more information. > >>> from xml import * > >>> dir() > ['__builtins__', '__doc__', '__name__', 'dom', 'parsers', 'sax'] > >>> from sax import * > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named sax > > The import statement doesn't work on things in the namespace. It works on > things in the module search path. > > Monty > > > > IronPython 0.9.2 is not allowing module import from packages that were > > previously imported. See below where I could not import from "Synthesis" > > after importing it from "System.Speech" unless explicitly importing it > > from > > "System.Speech.Synthesis". > > > > Anthony > > > > IronPython 0.9.2 on .NET 2.0.50215.44 > > Copyright (c) Microsoft Corporation. All rights reserved. > >>>> import sys > >>>> sys.LoadAssemblyByName('Speech') > >>>> from System.Speech import * > >>>> dir() > > ['AudioFormat', 'Recognition', 'SpeechManager', 'Synthesis', '_', > > '__builtins__' > > , '__doc__', '__name__', 'sys'] > >>>> from Synthesis import * > > Traceback (most recent call last): > > at > > ImportError: No module named Synthesis > >>>> dir(Synthesis) > > ['BookmarkEventArgs', 'FilePrompt', 'InstalledVoice', > 'PhonemeEventArgs', > > 'Promp > > t', 'PromptBreak', 'PromptBuilder', 'PromptEmphasis', 'PromptEventArgs', > > 'Prompt > > Rate', 'PromptStyle', 'PromptVolume', 'SayAs', > 'SpeakCompletedEventArgs', > > 'Speak > > ProgressEventArgs', 'SpeechSynthesizer', 'SynthesisMediaType', > > 'SynthesisTextFor > > mat', 'SynthesizerEmphasis', 'SynthesizerState', > > 'SynthesizerStateChangedEventAr > > gs', 'TtsEngine', 'VisemeEventArgs', 'VoiceAge', 'VoiceChangeEventArgs', > > 'VoiceG > > ender', 'VoiceInfo'] > >>>> from Synthesis import * > > Traceback (most recent call last): > > at > > ImportError: No module named Synthesis > >>>> from System.Speech.Synthesis import * > >>>> > > _______________________________________________ > > 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 s.kobalczyk at softwaremind.pl Fri Sep 30 10:54:33 2005 From: s.kobalczyk at softwaremind.pl (Szymon Kobalczyk) Date: Fri, 30 Sep 2005 10:54:33 +0200 Subject: [IronPython] Error when using Options.FastEval In-Reply-To: References: Message-ID: <433CFD49.9050509@softwaremind.pl> Hi, Last time I wrote here I was concerned with memory consumption and performance of embedding IronPython. I decided then to use the FastEval option. I think I found some error in this mode. In code below the last line would throw "Key not found in dictionary." exception caused by the "None" term. When you don't use the FastEval the code runs properly. static void Main(string[] args) { IronPython.AST.Options.FastEval = true; IronPython.AST.Options.DoNotSaveBinaries = true; PythonEngine engine = new PythonEngine(); engine.SetVariable("item", null); object value = engine.Evaluate("item == None"); } Also, could you please explain what exactly are the differences between the two modes. Szymon Kobalczyk.