[IronPython] Re: Why won't these snippets run?

2005-09-19 Thread Ray Djajadinata
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]

[IronPython] Re: Why won't these snippets run?

2005-09-19 Thread Fredrik Lundh
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"

RE: [IronPython] Re: Why won't these snippets run?

2005-09-19 Thread Martin Maly
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

[IronPython] Re: Why won't these snippets run?

2005-09-19 Thread Ray Djajadinata
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):

[IronPython] Re: Why won't these snippets run?

2005-09-19 Thread Ray Djajadinata
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 suga

RE: [IronPython] Re: Why won't these snippets run?

2005-09-19 Thread Martin Maly
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 g

[IronPython] Extension methods...

2005-09-19 Thread Keith J. Farmer
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.