Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # xrange_timeit.py
- import timeit
- def lookup_range():
- return range(100000)
- def lookup_xrange():
- return xrange(100000)
- print("Look up time in Range : {}".format(timeit.timeit('lookup_range()', 'from __main__ import lookup_range', number=1000)))
- print("Look up time in Xrange: {}".format(timeit.timeit('lookup_xrange()', 'from __main__ import lookup_xrange', number=1000)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement