To print some information every 10 loop iterations can be a bit messy. Given the following, simple loop:
for x in lots_of_stuff: process(x)
The "dumbest" way would be:
i = 0 for x in lots_of_stuff: process(x) if i % 10 == 0: print "Some progress info" i += 1
A more elegant solution would be to use the enumerate built-in:
for i, x in enumerate(lots_of_stuff): process(x) if i % 20 == 0: print "Some progress info"
Much nicer, but this doesn't work with while
loops