print(timeit('my_xrange()', setup='from __main__ import my_xrange'))
print(timeit('my_sequence()', setup='from __main__ import my_sequence'))
Why is a generator produced by yield faster than a generator produced by xrange?