Re: [IronPython] Array Access Problem

2005-05-07 Thread Drew Moore
Bob Ippolito wrote: There are ways you *could* fix the issue: (1) Don't have mutable value types, use a reference type that points to a value type (some kind of proxy) (2) Make value types immutable (or at least the ones you grab from collections) I kinda like both of these options. Darn dual pa

RE: [IronPython] System.Exception: can't convert 66.6 to System.Int32

2005-05-07 Thread Jim Hugunin
PhiHo Hoang wrote: > Why 66.6 cannot be converted to System.Int32 ? 66.6 can be both explicitly converted to an int and compared to one. >>> int(66.6) 66 >>> 12 < 66.6 True >>> 66.6 < 12 False It's a good thing that 66.6 won't be implicitly converted to an int since that would lose precision.

RE: [IronPython] lambda form

2005-05-07 Thread Jim Hugunin
March Liu wrote: > lambda key word may remove from CPython 3.0. Maybe we can replace it > by the other way as List Comprehensions, funcation Factory... I like to encourage people who come from a functional background to use list comprehensions instead of lambda when possible. I'm not sure that la

[IronPython] System.Exception: can't convert 66.6 to System.Int32

2005-05-07 Thread PhiHo Hoang
Greetings, Why 66.6 cannot be converted to System.Int32 ? Thanks, PhiHo a [333, 1234.5, 1, 333, -1, 66.6] a.sort() System.InvalidOperationException: Failed to compare two elements in the array. - --> System.Exception: can't convert 66.6 to System.Int32 at IronPython.Objects.Ops.ConvertTo

Re: [IronPython] lambda form

2005-05-07 Thread March Liu
lambda key word may remove from CPython 3.0. Maybe we can replace it by the other way as List Comprehensions, funcation Factory... 2005/5/7, Travis Watkins <[EMAIL PROTECTED]>: > On 5/7/05, PhiHo Hoang <[EMAIL PROTECTED]> wrote: > > Greetings, > > > > Does IronPython support lambda form ? > >

Re: [IronPython] lambda form

2005-05-07 Thread Travis Watkins
On 5/7/05, PhiHo Hoang <[EMAIL PROTECTED]> wrote: > Greetings, > > Does IronPython support lambda form ? > > Is this make_inc correct ? > > Thanks, > > PhiHo > > >>> def make_inc(n): > ... return lambda x : x + n > ... > >>> f = make_inc(100) > >>> f(1) > IronPython.Objects

[IronPython] lambda form

2005-05-07 Thread PhiHo Hoang
Greetings, Does IronPython support lambda form ? Is this make_inc correct ? Thanks, PhiHo def make_inc(n): ... return lambda x : x + n ... f = make_inc(100) f(1) IronPython.Objects.PythonNameError: name 'n' is not defined at IronPython.Objects.Frame.GetGlobal(String name) at inp