Python 3.5+ type annotations

# Python 3.5+ supports 'type annotations' that can be
# used with tools like Mypy to write statically typed Python:

def my_add(a: int, b: int) -> int:
    return a + b

If you think your friends would find this tip useful, please share it with them—I’d really appreciate it. Here's the link: View in browser

308 E. 5th Ave, Vancouver BC V5T 1H4

参考文档:

typing - Support for type hints 类型标注支持
PEP 3107 -- Function Annotations
7.3 给函数参数增加元信息
8.6 Function definitions

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容