1. python 文档字符串

Document String:

Here are some conventions about the content and formatting of documentation string:

The first line should be short, concise summary of the obejct's purpose. For brevity, it should not explicitly state the object's name or type,since these are available by other means . This line begin with a capital letter and end with a period.

If there are more lines in the documentations string.the second lines should be a blank. visually separating the summary from the rest of the description.The following lines should be one or more paragraphs describing the object's calling conventions ,its side effect,etc.

The Python parser does not strip indentation from the multi-line string liberals in Python. So tools that process documentation have to strip indentation if desired.This is done using the following convention. The first non-blank line after the first line of the string determines that the amount of indentation for the entire document string.whitespace "equivalent" to this indentation is then stripped from the start of all lines of the string .Lines that are indented less should not occur, but if they occur all their leading whitespace should be stripped. Equivalence of whitespace  should be tested after expansion of tabs.

Here are example of the multi-line docstring:

<pre name="code" class="python" style="text-align: justify;">def my_function():
    """ hey , first line is a short ,concise summary
          
        ok, the second line is a blank line ,it separating the summary from the rest of the description.
<span style="white-space:pre">	</span>"""
print (my_function.__doc__)

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值