#!/usr/bin/evn python #_*_ coding:utf-8 -*- import socket def auth(func): def inner(*args, **kwargs): print ‘befor‘ temp = func(*args,**kwargs) print ‘after‘ return temp return inner @auth def cpu(): print "CPU 性能告警" @auth def disk(): print "磁盘满了,快点删啊!" def f5(arg): print "i am f5",arg @auth def fetch_server_list(arg): server_list = [‘c1‘,‘c2‘,‘c3‘] return server_list ret = lamb_a.fetch_server_list(‘test‘) print ret 结果: befor after [‘c1‘, ‘c2‘, ‘c3‘]
本文出自 “风清云淡” 博客,请务必保留此出处http://ronray.blog.51cto.com/1434167/1911804
原文地址:http://ronray.blog.51cto.com/1434167/1911804