human
I am working on the file ".ipynb_checkpoints/Lecture4-checkpoint.ipynb".
The first task is:
9.1 Logging and timing a function

Decorators can be classes, they can take input arguments/keyword args.

Lets build a decorator that logs and times another function
Can you write Python program for it?
 ... Write me a the Python program you requested?
assistant
#Here is the Python program you requested.

import time
from pdb import set_trace
def logger(func):
    def inner(*args, **kwargs):
        print "Arguments were: %s, %s"%(args, kwargs)
        return func(*args, **kwargs)
    return inner

def timer(func):
    def inner(*args, **kwargs):
        t=time.clock()
        set_trace()
        func(*args, **kwargs)
        print "Time taken: %0.2f sec"%(time.clock()-t)
        return func(*args, **kwargs)
    return inner

@logger
@timer
def foo(a=5, b=2):
    time.sleep(2)
    return a+b

@logger
@timer
def bar(a=10, b=1):
    time.sleep(1)
    return a-b

foo(2,3)
bar(5,7)