see*_*aak 3 strong-typing python-3.x
我观察到对于以下功能
def foo(x: int) -> List[int]:
return x + 1
Run Code Online (Sandbox Code Playgroud)
可以使用表达式获取注释信息foo.__annotations__,结果为{'x': <class 'int'>, 'return': typing.List[int]}。
这是官方API吗?如果没有,是否存在官方 API 来获取对象的签名,如果有,它是什么?
| 归档时间: |
|
| 查看次数: |
1596 次 |
| 最近记录: |