Peter Otten wrote: > Repton wrote: > >>I often find myself storing data in a list of tuples, and I want to ask >>questions like "what is the index of the first tuple whose 3rd element >>is x", iter(n for n, elem in enumerate(lst) if elem[3] == x).next()
>>or "give me the first tuple whose 2nd element is y". iter(elem in lst if elem[3] == x).next() Does this look any better? At least it stops when the answer is found. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list