Comment on A neater way to print something every x iterations in Python

doug@neverfear.org
Tue, 11 Aug 2009 14:18:28 +0000

That's neat but two things should be that enumerate isn't automatically applied in Python 2.3 to 2.5 and it doesn't appear to be in 2.6 either.. what version of Python is that code for? You need to explicitly call enumerate() in the versions I tested.

for i, x in enumerate(lots_of_stuff):
    process(x)
    if i % 20 == 0:
        print "Some progress info"