If you have a long running list comprehension in Python, say:
from itertools import combinations
print [w for w in (''.join(c) for c in combinations(words, 2)) if sorted(w) == letters]
where words is a list of 200000 words and letters is a list of letters; is there any way to occasionally print out how many words has been processed so far or some other form of progress report?
You’ll need to convert it to a normal loop; don’t try to mix in a side-effect function:
or, if you want to track combinations tested, move the count before the
if: