def timecall(fn=None, immediate=True, timer=time.time):
 if (fn is None):
  def decorator(fn):
   return timecall(fn, immediate=immediate, timer=timer)
  return decorator
 fp = FuncTimer(fn, immediate=immediate, timer=timer)
 def new_fn(*args, **kw):
  return fp(*args, **kw)
 new_fn.__doc__ = fn.__doc__
 new_fn.__name__ = fn.__name__
 new_fn.__dict__ = fn.__dict__
 new_fn.__module__ = fn.__module__
 return new_fn

def timecall ( fn = None , immediate = True , timer = time . time ) : if ( fn is None ) : def decorator ( fn ) : return timecall ( fn , immediate = immediate , timer = timer ) return decorator fp = FuncTimer ( fn , immediate = immediate , timer = timer ) def new_fn ( * args , ** kw ) : return fp ( * args , ** kw ) new_fn . __doc__ = fn . __doc__ new_fn . __name__ = fn . __name__ new_fn . __dict__ = fn . __dict__ new_fn . __module__ = fn . __module__ return new_fn
wrap fn and print its execution time .