#!/usr/bin/env python2
#-*- coding: utf-8 -*-
def retry(attempt):
def decorator(func):
def wrapper(*args, **kw):
print args, kw
att = 0
while att < attempt:
func(*args, **kw)
att += 1
return wrapper
return decorator
# 重试次数
@retry(attempt = 3)
def test(s, x = 1):
print s
if __name__ == "__main__":
test('----', x = 2)