Discuss / Python / 前后加begin end的作业

前后加begin end的作业

Topic source

杨炎泽

#1 Created at ... [Delete] [Delete and Lock User]

import functools

def log(func): @functools.wraps(func) def wrapper(args, **kw): print("begain call") a = func(args, **kw) #先把返回值记录下来 print("end call") #打印 return a #返回返回值

return wrapper

@log def aaa(a, b): print(a + b);

aaa(1, 2);


  • 1

Reply