PCPP-32-101 · Question #18
Select the true statement related to PEP 257.
The correct answer is C. String literals that occur in places other than the first statement in a module, function, or class. String literals occurring elsewhere in Python code may also act as documentation. They are not recognized by the Python bytecode compiler and are not accessible as runtime object attributes (i.e. not assigned to __doc__), but two types of extra docstrings may be extracted by…
Question
Select the true statement related to PEP 257.
Options
- AString literals that occur immediately after another docstring are called attribute docstrings
- BAttribute docstrings and Additional docstrings are two types of extra docstrings that can be
- CString literals that occur in places other than the first statement in a module, function, or class
- DString literals that occur immediately after a simple assignment at the top level of a module are
How the community answered
(32 responses)- A3% (1)
- C94% (30)
- D3% (1)
Explanation
String literals occurring elsewhere in Python code may also act as documentation. They are not recognized by the Python bytecode compiler and are not accessible as runtime object attributes (i.e. not assigned to doc), but two types of extra docstrings may be extracted by software String literals occurring immediately after a simple assignment at the top level of a module, class, or init method are called "attribute docstrings". String literals occurring immediately after another docstring are called "additional docstrings".
Topics
Community Discussion
No community discussion yet for this question.