nerdexam
Python_Institute

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…

PEP and Best Practices

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)
  • A
    3% (1)
  • C
    94% (30)
  • D
    3% (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

#PEP 257#docstrings#attribute docstrings#documentation conventions

Community Discussion

No community discussion yet for this question.

Full PCPP-32-101 Practice