Convenient filtering in for cycles

alex23 wuwei23 at gmail.com
Wed Oct 5 23:42:18 EDT 2011


On Oct 6, 2:55 am, Stefano Maggiolo <s.maggi... at gmail.com> wrote:
> I would like to know if there is a (more) convenient way of doing this
> structure:
>
> ===(1)===
> for x in l:
>     if P(x):
>         do_stuff(x)
> ======

map(do_stuff, filter(P, l))



More information about the Python-list mailing list