我应该如何在文档字符串中对类似的异常进行分组?
How should I group similar exceptions in a docstring?
我没有在任何风格指南中看到它。我应该合并相似的异常类型还是将它们拆分成单独的行:
"""
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
"""
我想第二个。
"""
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. ...
"""
我没有在任何风格指南中看到它。我应该合并相似的异常类型还是将它们拆分成单独的行:
"""
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
"""
我想第二个。
"""
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. ...
"""