您现在的位置是:首页>全部文章全部文章 python多行注释规范 2021年1月16日 22:05【python】【规范】【注释】268人已围观 ## reST 这是现在流行的一种风格,reST风格,Sphinx的御用格式。 ```python """ This is a reST style. :param param1: this is a first param :param param2: this is a second param :returns: this is a description of what is returned :raises keyError: raises an exception """ ``` ## Epytext 这是曾经比较流行的一直类似于javadoc的风格。 ```python """ This is a javadoc style. @param param1: this is a first param @param param2: this is a second param @return: this is a description of what is returned @raise keyError: raises an exception """ ``` ## Google风格 ```python """ This is a groups style docs. Parameters: param1 - this is the first param param2 - this is a second param Returns: This is a description of what is returned Raises: KeyError - raises an exception """ ``` ## Numpydoc (Numpy风格) ```python """ My numpydoc description of a kind of very exhautive numpydoc format docstring. Parameters ---------- first : array_like the 1st param name `first` second : the 2nd param third : {'value', 'other'}, optional the 3rd param, by default 'value' Returns ------- string a value in a string Raises ------ KeyError when a key error OtherError when an other error """ ``` 上一篇:1.两数之和 下一篇:单例模式之Python实现 相关文章 理解Python中的yield 使用ctypes优化Python代码 python如何实现超长整数? 通过无损压缩减少NumPy内存使用 python海象运算符":="的三种用法 Python的 5 种高级用法,效率提升没毛病! Python中"is"和"=="的区别 工厂模式之Python实现 单例模式之Python实现 使用Python识别验证码 文章评论 共有268条评论来说两句吧... 用户名: 阅读排行 使用Python识别验证码 Django DTL常用过滤器 python多行注释规范 python如何实现超长整数? 工厂模式之Python实现 通过无损压缩减少NumPy内存使用 1.两数之和 单例模式之Python实现 python海象运算符":="的三种用法 Python中"is"和"=="的区别 站长推荐 Django DTL常用过滤器 标签云 公告 python 验证码 Django DTL 过滤器 算法 LeetCode 规范 注释 设计模式 Linux Apache Numpy jupyter ctypes 站点信息 文章统计:16条 文章评论:2条 点赞统计: 24个 统计数据:百度统计 微信公众号:扫描二维码,关注我们 站点地图:SiteMap