#!/usr/local/bin/python2 l = range(50) for i in xrange(100000): r = (e for e in reversed(l) if e < 25) next(r, None)