【发布时间】:2021-08-28 23:05:27
【问题描述】:
我正在寻找函数的注释,特别是每个注释的联合值。举个例子:
from typing import Union
async def func(arg1: str, arg2: int, arg3: Union[str, int]):
...
# Want to get
# {arg3: [str, int], arg1: str, ...}
我知道 func.__annotations__ 返回字典,但我不确定 Union 类型提示
【问题讨论】:
标签: python annotations python-typing