【发布时间】:2016-02-28 08:24:25
【问题描述】:
鉴于新的 Python 3.5 允许使用类型签名进行类型提示,我想使用新功能,但我不知道如何使用以下结构完全注释函数:
def yieldMoreIfA(text:str):
if text == "A":
yield text
yield text
return
else:
yield text
return
正确的签名是什么?
【问题讨论】:
标签: python python-3.x annotations type-hinting