human
I am working on the file "Lecture4.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?

=====
What is 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):
        tb=time.time()
        result = func(*args, **kwargs)
        ta=time.time()
        print "Time taken: %f sec"%(ta-tb)
        return result
    return inner

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

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

if __name__=='__main__': ## <----- Note
    foo(2,3)
    bar(5,7)