[IronPython] lambda form

March Liu march.liu at gmail.com
Sat May 7 17:00:56 CEST 2005


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 <alleykat at gmail.com>:
> On 5/7/05, PhiHo Hoang <phiho.hoang at rogers.com> 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.PythonNameError: name 'n' is not defined
> >    at IronPython.Objects.Frame.GetGlobal(String name)
> >    at input_98.lamda$0$f10(Object x)
> >    at IronPython.Objects.Function1.Call(Object arg0)
> >    at IronPython.Objects.Ops.Call(Object func, Object arg0)
> >    at input_100.Run(Frame frame)
> >    at IronPython.Hosting.PythonEngine.DoOneInteractive(Frame topFrame)
> >    at IronPython.Hosting.PythonEngine.RunInteractive()
> > >>>
> > _______________________________________________
> > users-ironpython.com mailing list
> > users-ironpython.com at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> 
> That works on CPython so I'd say it's a bug.
> 
> --
> Travis Watkins
> http://www.realistanew.com
> _______________________________________________
> users-ironpython.com mailing list
> users-ironpython.com at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 


-- 
欢迎访问:
http://blog.csdn.net/ccat

刘鑫
March.Liu


More information about the Ironpython-users mailing list