Certified Professional in Python Programming (PCPP-32-101) — Question 6
Select the true statement related to PEP 257.
Answer options
- A. String literals that occur immediately after another docstring are called attribute docstrings
- B. Attribute docstrings and Additional docstrings are two types of extra docstrings that can be extracted by software tools
- C. String literals that occur in places other than the first statement in a module, function, or class definition can act as documentation. They are recognized by the Python bytecode compiler, and are accessible as runtime object attributes.
- D. String literals that occur immediately after a simple assignment at the top level of a module are called complementary docstrings
Correct answer: B
Explanation
The correct answer is B because it accurately describes that attribute docstrings and additional docstrings are types of extra docstrings that can be utilized by software tools. Options A, C, and D do not correctly represent the definitions or roles of docstrings as per PEP 257, leading to their incorrectness.