【发布时间】:2017-03-31 21:25:29
【问题描述】:
在 Python 3 中,您可以为函数参数添加描述:
def foo(host: 'ip address for connection')
cool_stuff()
您还可以提供预期的类型,稍后可以通过mypy 进行检查:
def foo(host: str)
cool_stuff()
在我看来两者都非常有用 - 有没有办法将两者结合起来仍然可以让mypy 检查一致性?
【问题讨论】:
标签: python python-3.x arguments type-hinting mypy