[Tutor] Selecting first matching element from a list

Kent Johnson kent37 at tds.net
Wed Jan 14 18:31:55 CET 2009


On Wed, Jan 14, 2009 at 11:25 AM, bob gailer <bgailer at gmail.com> wrote:
> How many ways are there in Python to go thru a list (and apply a function to
> each element)? The ones I know are:
> while
> for
> list comprehension
> map()

filter() is more appropriate than map() for this problem
generator expression
itertools functions

Kent


More information about the Tutor mailing list