网站首页 > 技术文章 正文
函数说明文档,顾名思义就是一个对函数说明的信息文档
格式如下:
def 函数名():
"""
用3对双引号进行包裹,这里就是函数的说明文档,用来对函数的功能,使用方式等进行说明
以便开发人员能够快速的了解此函数
"""
pass
函数文档对于我们的意义:
Python内置了很多的函数,但这些函数具体的功能不是我们编写的,我们很难在较短的时间内读懂函数的实现代码
但是只要有了函数说明文档,我们就能快速的知道这个函数的作用,能够大大提高可读性
那怎样用函数的说明文档呢?
Help on built-in function print in module builtins:
print(...)
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
给大家的建议:
编写的代码不仅仅是自己看,还有可能是同事看、同学看、领导看等
当我们的代码中有函数,虽然函数说明文档可写可不写,但是建议大家写上,这样会更加规范
猜你喜欢
- 2024-10-01 利用神经网络模型检测摄像头上的可疑行为
- 2024-10-01 使用神经网络的自动化特征工程(神经网络的特点及使用场景)
- 2024-10-01 Python基础学习必备的8个最常用的内置函数
- 2024-10-01 利用Click和argparse给你Python程序构建一个优雅的命令行界面
- 2024-10-01 langchain中的LLM模型使用介绍(llvm 分析)
- 2024-10-01 学习Python内置函数(range)来打印数学乘法表
- 2024-10-01 Python 100天 15:print("hello world")茴香豆的写法
- 2024-10-01 python3入门实例一:Hello World(python的hello world程序编写)
- 2024-10-01 python基础篇:讲讲python的内置函数一
- 2024-10-01 Python3中的print函数(python里的print函数)
- 最近发表
- 标签列表
-
- cmd/c (57)
- c++中::是什么意思 (57)
- sqlset (59)
- ps可以打开pdf格式吗 (58)
- phprequire_once (61)
- localstorage.removeitem (74)
- routermode (59)
- vector线程安全吗 (70)
- & (66)
- java (73)
- org.redisson (64)
- log.warn (60)
- cannotinstantiatethetype (62)
- js数组插入 (83)
- resttemplateokhttp (59)
- gormwherein (64)
- linux删除一个文件夹 (65)
- mac安装java (72)
- reader.onload (61)
- outofmemoryerror是什么意思 (64)
- flask文件上传 (63)
- eacces (67)
- 查看mysql是否启动 (70)
- java是值传递还是引用传递 (58)
- 无效的列索引 (74)