高阶函数

import time

def bar():
    time.sleep(3)
    print('in the bar')


def test1(func):
    start_time=time.time()
    # print(func)
    func()
    stop_time=time.time()
    print('the func is %s' %(stop_time-start_time))

test1(bar)


执行结果:
in the bar
the func is 3.000213623046875

  

posted on 2017-03-14 22:37  裤裆内隐藏杀气  阅读(144)  评论(0编辑  收藏  举报

导航