def timing_lines(func):
def wrapper(*args,**kwargs):
from line_profiler import LineProfiler
lp=LineProfiler()
lp_wrapper=lp(func)
result=lp_wrapper(*args,**kwargs)
lp.print_stats()
return result
return wrapper
@timing_lines
def do_stuff(numbers):
s = sum(numbers)
l = [numbers[i]/43 for i in range(len(numbers))]
m = ['hello'+str(numbers[i]) for i in range(len(numbers))]
return s
numbers = [i for i in range(100)]
s=do_stuff(numbers)