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