首页 > 代码库 > decorator

decorator

def log(func):
	def wrapper(*args,**kw):
		print 'call %s():'%func.__name__
		return func(*args,**kw)
	return wrapper
@log
def now():
	print 'hello!'
now()

decorator