【发布时间】:2014-07-27 13:40:08
【问题描述】:
是否有一种标准的 Pythonic 方式来表示函数的参数类型和返回类型?
我正在寻找的符号是:
-
help()可识别 - IDE 可识别
- (最好)在 PEP 中描述
我见过一些例子,比如this reSt syntax:
"""replaces template place holder with values
:param timestamp: formatted date to display
:type timestamp: str or unicode
:param priority: priority number
:type priority: str or unicode
:param priority_name: priority name
:type priority_name: str or unicode
:param message: message to display
:type message: str or unicode
:returns: formatted string
:rtype: str or unicode
"""
但是,我不确定这种格式的官方/支持程度如何。
【问题讨论】:
标签: python python-2.7 types return-type docstring