Alex Willmer <a...@moreati.org.uk> writes: > i = 0 > for x in seq: > # do stuff > i += 1 > print 'Processed %i records' % i > > Just thought it worth mentioning, curious to hear other options/ > improvements/corrections.
Stephen gave an alternate patch, but you are right, it is a pitfall that can be easy to miss in simple testing. A more "functional programming" approach might be: def do_stuff(x): ... n_records = sum(1 for _ in imap(do_stuff, seq)) -- http://mail.python.org/mailman/listinfo/python-list