我想指定 Pydoc 记录我的函数的顺序。我不确定 Pydoc 如何在生成的文档中对函数进行排序——它肯定不是模块中的文本顺序。
这很有用,因为我想先指定printUsage()
要记录的函数。
"""
Sample module docstring
"""
def printUsage():
"""
Command line usage: python my_module.py -i path/to/input_file.c
If calling my_function() directly, pass the path/to/input_file.c as an arg.
"""
print(printUsage.__doc__)
...
因此,当用户签出 docstring 时my_module
,他可以快速了解如何使用它。