Using filter()

Emile van Sebille emile at fenx.com
Tue Jul 18 20:09:46 EDT 2000


That's an optimization that passes string.find into the
lambda's namespace.

--

Emile van Sebille
emile at fenx.com
-------------------


"Larry Whitley" <ldw at us.ibm.com> wrote in message
news:8l2g53$14ha$1 at news.rchland.ibm.com...
> Thanks, that certainly works.
>
> I don't understand why lambda needs the second parameter.
When I experiment
> with
>
> filter( lambda x: string.find( x, name) == 0, fileList)
>
> in place of
>
> filter( lambda x,sf=string.find: sf(x, name )==0,
fileList )
>
> it works as well.  I suspect that your codeing come from
something more
> general.  Can you explain the reason the sf=string.find
construction is
> useful in this context?






More information about the Python-list mailing list