Permalink
Browse files

Flush output for notifying iters

  • Loading branch information...
jamii committed Mar 24, 2012
1 parent 84788fe commit 7a6acd66bf45352ebf508f44fb0023ecb275c40f
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/util.py
View
@@ -2,6 +2,7 @@
import datetime
import re
import itertools
+import sys
def date(string):
"""Date of a yyyy-mm-dd string"""
@@ -42,9 +43,12 @@ def notifying_iter(iter, name, interval=10000):
name = name + ":"
i = 0
print name, 'starting'
+ sys.stdout.flush()
for value in iter:
i += 1
if i % interval == 0:
print name, i
+ sys.stdout.flush()
yield value
print name, 'finished'
+ sys.stdout.flush()

0 comments on commit 7a6acd6

Please sign in to comment.