"MonkeeSage" <[EMAIL PROTECTED]> writes: > > This genexp is better than a loop because it bails out immediately > > if it finds an out-of-range x. > > That's true: assuming that input is sequential. But if it's farily > random (e.g., [10, 20, 12, 46, 202, 5, 102]), then you need a loop/ > list comp. to check each index.
Maybe I didn't undrestand the question. Say maxnum is 30 in your example above. Then as soon as 46 is seen, you can stop checking, I thought. -- http://mail.python.org/mailman/listinfo/python-list