Searching through a list of tuples

Peter Otten __peter__ at web.de
Wed Jul 13 13:37:13 EDT 2005


Scott David Daniels wrote:

> iter(elem in lst if elem[3] == x).next()
> 
> Does this look any better?  At least it stops when the answer is found.

Next time you'll recommend

if (a>b) == True: 
    # ...

Watch out, you're on a slippery slope here :-)

Peter




More information about the Python-list mailing list