[IronPython] how to use Predicates in IPy?

Count László de Almásy calmasy at gmail.com
Fri Jul 24 22:19:04 CEST 2009


both attempts give a TypError:

>>> sim.ObjectsPrimitives.FindAll(lambda inst:True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Multiple targets could match: FindAll(Predicate[UInt32]),
FindAll(Predicate[Primitive])

On Fri, Jul 24, 2009 at 10:15 AM, Dino Viehland<dinov at microsoft.com> wrote:
> You can just do:
>
> x.FindAll(lambda inst:True)
>
> or:
>
> def MyPredicate(obj):
>        return True
>
> x.FindAll(MyPredicate)
>
>> -----Original Message-----
>> From: users-bounces at lists.ironpython.com [mailto:users-
>> bounces at lists.ironpython.com] On Behalf Of Count László de Almásy
>> Sent: Friday, July 24, 2009 12:04 AM
>> To: Discussion of IronPython
>> Subject: [IronPython] how to use Predicates in IPy?
>>
>> I've been unable to find any examples of how to define/use Predicates
>> in IPy, as for use with .NET's List(T).FindAll method. Specifically
>> I'm trying to use
>> http://lib.openmetaverse.org/docs/trunk/html/M_OpenMetaverse_InternalDi
>> ctionary_2_FindAll_1.htm
>>
>> Anyway, if someone could help with an example of how to do such things
>> in IPy I'd greatly appreciate. The one mention of it in this list's
>> archives is from 2006 and refers to an example url that is now broken.
>>
>> --
>> Cheers, László
>> _______________________________________________
>> Users mailing list
>> Users at lists.ironpython.com
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



-- 
Cheers, László



More information about the Ironpython-users mailing list