【发布时间】:2016-09-01 07:52:39
【问题描述】:
我在其他人的 Python 代码中看到他们在函数的文档字符串之前粘贴了一些检查;像这样:
def func(args):
if x_version != 1.7:
return
"""docstring is here"""
# function body code
# ...
是否存在您应该或必须在文档字符串之前放置一些代码以解决任何问题的情况?是否有任何特殊情况必须引入这种样式,或者它总是只是一种不好的样式,因此必须固定为这样的东西?
def func(args):
"""docstring is here"""
if x_version != 1.7:
return
# function body code
# ...
【问题讨论】:
标签: python function docstring pep