def log_args_and_results(*args, **kwargs): print('{}({}): enter'.format( fn.__name__, format_args(*args, **kwargs))) # call the decorated function result = fn(*args, **kwargs) # unwrap the argument lists print('{}({}): exit, result: {}'.format( fn.__name__, format_args(*args, **kwargs), result)) return result
def profile(*args, **kwargs): before = process_time() # call the decorated function result = decorated_fn(*args, **kwargs) # unwrap the argument list print('{}({}) ran in {} secs'.format(decorated_fn.__name__, format_args(*args, **kwargs), process_time() - before)) return result
def profile(*args, **kwargs): before = process_time() # call the decorated function result = decorated_fn(*args, **kwargs) # unwrap the argument list print('{}({}) ran in {} secs'.format( decorated_fn.__name__, format_args(*args, **kwargs), process_time() - before)) return result