【发布时间】:2017-03-28 15:11:37
【问题描述】:
我正在深入研究 Python 中的类型提示,当我们谈论内置对象的类型提示时,一切都很清楚。但我不明白某些包中对象的类型提示应该是什么。例如,这是我使用 falcon web-framework 的代码:
def on_post(self, req, resp):
当我对变量 req 和 resp 使用类型函数时,我分别得到“类'falcon.request.Request'和“类'falcon.response.Response'”,那么这个变量的类型提示应该是什么?喜欢:
def on_post(self, req: 'falcon.request.Request', resp: 'falcon.response.Response') -> None:
【问题讨论】:
标签: python type-hinting static-typing