用 Python 编写类或方法的文档很容易:
class Something:
""" Description of the class. """
def do_it(self):
""" Description of the method. """
pass
class_variable = 1 # How to comment?
@property
def give_me_some_special_dict(self):
""" doesn't work! Doc of general dict will be shown. """
return {}
但是如何为 API 文档或 help
中使用的字段或属性编写文档呢?