1#In Python 2.6 or newer:
2
3#If you want StopIteration to be raised if no matching element is found:
4next(x for x in the_iterable if x > 3)
5#If you want default_value (e.g. None) to be returned instead:
6next((x for x in the_iterable if x > 3), default_value)