Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Commit

Permalink
Flush output for notifying iters
Browse files Browse the repository at this point in the history
  • Loading branch information
jamii committed Mar 24, 2012
1 parent 84788fe commit 7a6acd6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/util.py
Expand Up @@ -2,6 +2,7 @@
import datetime
import re
import itertools
import sys

def date(string):
"""Date of a yyyy-mm-dd string"""
Expand Down Expand Up @@ -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.