You could use a co-routine to generate the magic numbers. Something like this:
def gen_magic_nums():
for i in range(100):
yield i**2
for num in gen_magic_nums():
add_to_plot(num)