[IronPython] Lamba Expressions in IronPython

Curt Hagenlocher curt at hagenlocher.org
Mon Apr 7 02:01:10 CEST 2008

On Sun, Apr 6, 2008 at 4:54 PM, Ben Hall <ben2004uk at googlemail.com> wrote:
> My CLR object is just a wrapper around a generic list (as generics
> aren't supported?)

Sure they are.

import System
from System.Collections.Generic import List
i = List[int]()

> I guess I can use a method\delegate like in C# 2.0, but is there any
> way to do anything like Lamba Expressions?  Or is there something
> similar in Python?

Yes, lambda expressions have been a part of Python since the early
days.  They use the "lambda" keyword.

i = List[int]()
v = i.Find(lambda obj: obj == 1)

Curt Hagenlocher
curt at hagenlocher.org

More information about the Ironpython-users mailing list