周围空白符 (D210) 源自 pydocstyle 代码检查器。 有时提供修复。 作用 检查文档字符串中是否存在周围空白符。 为什么这不好? 为了保持一致性,请从文档字符串中删除周围的空白符。 示例 def factorial(n: int) -> int: """ Return the factorial of n. """ 建议改为 def factorial(n: int) -> int: """Return the factorial of n.""" 参考 PEP 257 – 文档字符串约定 NumPy 风格指南 Google Python 风格指南 - 文档字符串