python-3.x - Python类型提示的未知变量
问题描述
我有一个包装函数,如果要返回的变量未知,我应该把什么作为返回值?
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}:
解决方案
推荐阅读
- javascript - 如何将较大项目中的一个打字稿文件编译为不同的文件扩展名?
- excel - VBA 查找文本并将下 50 个单元格复制到其他工作表
- c++ - 如何使用 yaml-cpp 构建节点?
- python - 如何在 f 格式中使用 string.len() 函数?
- node.js - 在节点 child_process 事件处理程序之间共享数据的“正确”方式是什么?
- c# - ASP.NET Core API 空 XML 对象
- r - 如何从 R 中的字符向量中提取独特的表情符号?
- c - 有序列表搜索算法的输出不正确
- python-3.x - 使用 numpy 在矩阵中设置交替的非对角线元素
- javascript - 数据确认应包括检查的无线电输入的名称或值