【发布时间】:2017-06-06 12:21:44
【问题描述】:
我想使用 Jedi 为我的 Python 代码添加一些自动完成功能的支持。这可以通过使用函数文档字符串或类型提示(或两者)来完成。
def function_with_types_in_docstring(param1, param2):
"""Example function with types documented in the docstring.
:type param1: int
:type param2: str
:rtype: bool
"""
def function_with_pep484_type_annotations(param1: int, param2: str) -> bool:
"""Example function with PEP 484 type annotations."""
哪种记录类型的方法在内存使用和运行时间方面增加的开销更少?我首先对 Python 代码本身的效率感兴趣,然后是 Jedi。
【问题讨论】:
标签: python python-3.x type-hinting docstring python-jedi