[Python-ideas] Predicate Sets

Serhiy Storchaka storchaka at gmail.com
Tue Jan 21 10:09:32 CET 2014


21.01.14 10:58, Haoyi Li написав(ла):
>  > *all(map(list_of_filters, value))*
>
> Scratch that, what I actually want is
>
> *all(map(lambda f: f(value), list_of_filters))*
> *
> *
> I always mix up the order of things going into *map* =(*
> *

     all(f(value) for f in list_of_filters)

looks cleaner to me.

Perhaps slightly more efficient (but much less readable) form:

     all(map(operator.methodcaller('__call__', value), list_of_filters)




More information about the Python-ideas mailing list