According to PEP 257, what is the standard format for a single-line docstring?
Trap 1: Use a single quote for the entire block.
Triple quotes are required for docstrings.
Trap 2: The docstring should span three lines including the summary.
That is for multi-line docstrings.
Trap 3: The summary should start on the next line.
PEP 257 suggests keeping it on the same line for brevity.
- A
Use a single quote for the entire block.
Why wrong: Triple quotes are required for docstrings.
- B
The docstring should span three lines including the summary.
Why wrong: That is for multi-line docstrings.
- C
The summary should start on the next line.
Why wrong: PEP 257 suggests keeping it on the same line for brevity.
- D
Use triple quotes and keep the summary on the same line, ending with a period.
This is the recommended convention for short docstrings.