2
我沒有看到它在任何風格指南中提到。我應該結合類似的異常類型或它們拆分爲單獨行:如何分組文檔中的類似異常?
"""
This is a Google style docs.
...
...
Raises:
TypeError: foo() missing 1 required positional argument. Key must be a numeric value.
KeyError: bar
"""
或本:
"""
This is a Google style docs.
...
...
Raises:
TypeError: foo() missing 1 required positional argument
TypeError: key must be a numeric value
KeyError: bar
"""
你看過https://www.python.org/dev/peps/pep-0257/嗎? –
我寧願第二個,將保持文檔字符串更具可讀性。如果出現同樣的錯誤的原因超過了兩個,將會保持較短的行數。 –
@VivekSable這並沒有提到OP想要做什麼,是嗎? –