Kon*_*ads 25 python comments docstring
什么,在您看来是一个有意义的文档?你期望在那里描述什么?
例如,考虑这个Python类__init__:
def __init__(self, name, value, displayName=None, matchingRule="strict"):
"""
name - field name
value - field value
displayName - nice display name, if empty will be set to field name
matchingRule - I have no idea what this does, set to strict by default
"""
Run Code Online (Sandbox Code Playgroud)
你觉得这有意义吗?发布您的好/坏示例供所有人知道(以及一般答案,以便可以接受).
查看numpy的docstrings以获得很好的例子(例如http://github.com/numpy/numpy/blob/master/numpy/core/numeric.py).
文档字符串分为几个部分,如下所示:
Compute the sum of the elements of a list.
Parameters
----------
foo: sequence of ints
The list of integers to sum up.
Returns
-------
res: int
sum of elements of foo
See also
--------
cumsum: compute cumulative sum of elemenents
Run Code Online (Sandbox Code Playgroud)