timeit.timeit('for i in range(10000): i % 65536', number=1000)
timeit.timeit('for i in range(10000): i % 256**2', number=1000)
timeit.timeit('for i in range(10000): i % 4**8', number=1000)
timeit.timeit('for i in range(10000): i % 2**16', number=1000)
timeit.timeit('for i in range(10000): i % 65536', number=1000)
Why is taking the mod of a number in python faster with exponents?