2015-05-14 21 views
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 
""" 
+1

你看過https://www.python.org/dev/peps/pep-0257/嗎? –

+0

我寧願第二個,將保持文檔字符串更具可讀性。如果出現同樣的錯誤的原因超過了兩個,將會保持較短的行數。 –

+0

@VivekSable這並沒有提到OP想要做什麼,是嗎? –

回答

0

我想一起去第二次。

""" 
This is a Google style docs. 
... 
... 
Raises: 
    TypeError: 1. foo() missing 1 required positional argument. 
       2. key must be a numeric value. 
       3. ... 
    KeyError: 1. bar key is missing. 
       2. ... 
""" 
+0

@dbliss:好的。也許。發佈答案後,我閱讀了您的評論。你可以添加你的答案,我會投票。 –