I want to test the performance of some code using an exponentially increasing value. So that as an extra digit is added to the numbers_size the increment is multiplied by 1
The simplest thing to do is to use a linear sequence of exponents:
for e in range(1, 90):
i = int(10**(e/10.0))
test(i)
You can abstract the sequence into its own generator:
def exponent_range(max, nsteps):
max_e = math.log10(max)
for e in xrange(1, nsteps+1):
yield int(10**(e*max_e/nsteps))
for i in exponent_range(10**9, nsteps=100):
test(i)
To produce the same numbers as your code:
numbers_sizes = (i*10**exp for exp in range(2, 9) for i in range(1, 10))
for n in numbers_sizes:
test(n)