tongjie 最近的时间轴更新
tongjie

tongjie

V2EX 第 185368 号会员,加入于 2016-08-04 11:32:03 +08:00
tongjie 最近回复了
2016-08-08 22:49:09 +08:00
回复了 SlipStupig 创建的主题 Python 想请教一下 python 装饰器的作用
def safe_run(_logger):
def _run_once(func):
def f(*args,**kwargs):
try:
return func(*args,**kwargs)
except:
_logger.error(traceback.format_exc())
return f
return _run_once

在要执行的方法前面加上这个装饰器,放心多了;
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3071 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 14:58 · PVG 22:58 · LAX 07:58 · JFK 10:58
Developed with CodeLauncher
♥ Do have faith in what you're doing.