lambda fctions & local variables
John Lehmann
jlehmann at nsw.bigpond.net.au
Mon Feb 28 08:15:57 EST 2000
Do you want something like this?
def find(pattern,list):
return filter(lambda x, p = pattern: match(p, x), list)
Frantisek Kvapil wrote:
>
> Hello,
>
> I have some matching function:
> def match(pattern,value):
> return len(pattern)==len(value)
>
> and some finding function:
> def find(pattern,list):
> return filter(lambda x: match(pattern,x),list)
>
> but the problem is that the lambda function don't know
> local variable pattern,
>
> so may you be so nice to tell me how to make it works
> (still using lambda functions if possible)
>
> thanks and have nice day
>
> Frantisek Kvapil
More information about the Python-list
mailing list