I am trying to write a decorator that will print dots in terminal while the function that calls the decorator executes.
import sys
from time import sleep
def call_counter(func):
    def helper(*args, **kwargs):
        for dot in xrange(0, 99):
            sys.stdout.write(".")
            sys.stdout.flush()
        return func(*args, **kwargs)
    helper.calls = 0
    helper.__name__= func.__name__
    return helper
@call_counter
def f():
    sleep(10)
if __name__ == "__main__":
    f()
this is what I have tried so far. But i am not getting expected result. for function taking time to execute I have used sleep of 10 seconds .
 
    