This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ConfigParser.get() doc to be updated according to the configparser.py header doc
Type: enhancement Stage: needs patch
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, fdrake, khyox, martin.panter
Priority: normal Keywords:

Created on 2016-01-13 00:39 by khyox, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg258124 - (view) Author: khyox (khyox) * Date: 2016-01-13 00:39
For the sake of clarity, in https://docs.python.org/3.5/library/configparser.html#configparser.ConfigParser the ConfigParser.get() method doc could be properly updated with merging the information written in the header doc of the source file, as found in https://hg.python.org/cpython/file/3.5/Lib/configparser.py

Concretely, this sentence there, "Return a string value for the named option." could be considered quite relevant to be added to the doc of the method, as some packages are (incorrectly) expecting boolean values returned by the ConfigParser.get() method. The reality is that a "True" in the configuration file is returning the string "True" and not the boolean constant True.

To sum up, the suggested update would be:

    def get(self, section, option, *, raw=False, vars=None, fallback=_UNSET):
        """Returns a string value for the named option for a given section.

        If `vars' is provided, it must be a dictionary. The option is looked up
        in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
        If the key is not found and `fallback' is provided, it is used as
        a fallback value. `None' can be provided as a `fallback' value.

        If interpolation is enabled and the optional argument `raw' is False,
        all interpolations are expanded in the return values.

        Arguments `raw', `vars', and `fallback' are keyword only.

        The section DEFAULT is special.
        """
        (...)
msg258337 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-01-15 22:49
Perhaps the doc string of the module should be condensed into a much shorter summary of the class and its methods, and the details should be moved to individual doc strings and the main documentation.
History
Date User Action Args
2022-04-11 14:58:26adminsetgithub: 70282
2016-01-15 22:49:23martin.pantersetnosy: + martin.panter

messages: + msg258337
stage: needs patch
2016-01-15 18:48:20fdrakesetnosy: + fdrake
2016-01-13 00:39:59khyoxcreate