【发布时间】:2018-08-13 19:00:13
【问题描述】:
我有一个包装函数,如果要返回的变量是未知的,我应该把什么作为返回值?
def try_catch_in_loop(func_to_call: callable, *args):
for attempt in range(NUM_RETRYS + 1):
try:
if attempt < NUM_RETRYS:
return func_to_call(*args)
else:
raise RunTimeError("Err msg")
except gspread.exceptions.APIError:
request_limit_error()
具体看看在函数调用的末尾放什么,即:
def try_catch_in_loop(...) -> {What do I put here}:
【问题讨论】:
标签: python-3.x type-hinting pep