关于作者

Discuss / Python / 想法比较复杂

想法比较复杂

问题来源

变幻的世界观

#1 Created at ...

import functools L = ['begin call','end call']

def log(text): def decorator(func): @functools.wraps(func) def wrapper(args, **kw): print('%s %s():' % (text[0], func.name)) func(args, **kw) print(L[-1]) pass return wrapper return decorator

@log(L) def now(): print('2015-3-25')

now() print(now._


  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.