V2EX  ›  英汉词典

Docstring

释义 Definition

docstring(文档字符串):在编程中(尤指 Python),指写在模块、类、函数等对象开头的一段字符串,用来说明其用途、参数、返回值与用法,常被文档工具自动提取生成说明文档。

发音 Pronunciation

/ˈdɑːkˌstrɪŋ/

例句 Examples

A good docstring explains what the function does.
一个好的文档字符串能解释这个函数的作用。

Before publishing the library, she rewrote the docstrings to include clear examples and edge cases so new users could understand the API quickly.
在发布这个库之前,她重写了文档字符串,补充了清晰的示例和边界情况,让新用户能更快理解该 API。

词源 Etymology

docstringdocumentation(文档)+ string(字符串)的合成词,主要流行于编程语境,尤其与 Python 社区的编码与文档规范密切相关;含义直观:用“字符串”来写“文档说明”。

相关词 Related Words

文学与作品 Literary Works

  • PEP 257 — Docstring Conventions(Python 增强提案:文档字符串规范)
  • The Python Tutorial(Python 官方教程中多处讨论文档与字符串用法)
  • Python Documentation(Python 官方文档,广泛使用并说明 docstring 的作用)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1638 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 00:38 · PVG 08:38 · LAX 16:38 · JFK 19:38
♥ Do have faith in what you're doing.