@@ -35,6 +35,18 @@ section, or values in a special ``DEFAULT`` section. Additional defaults can be
3535provided on initialization and retrieval. Lines beginning with ``'#' `` or
3636``';' `` are ignored and may be used to provide comments.
3737
38+ Configuration files may include comments, prefixed by specific characters (``# ``
39+ and ``; ``). Comments may appear on their own in an otherwise empty line, or may
40+ be entered in lines holding values or spection names. In the latter case, they
41+ need to be preceded by a whitespace character to be recognized as a comment.
42+ (For backwards compatibility, only ``; `` starts an inline comment, while ``# ``
43+ does not.)
44+
45+ On top of the core functionality, :class: `SafeConfigParser ` supports
46+ interpolation. This means values can contain format strings which refer to
47+ other values in the same section, or values in a special ``DEFAULT `` section.
48+ Additional defaults can be provided on initialization.
49+
3850For example::
3951
4052 [My Section]
@@ -100,6 +112,11 @@ write-back, as will be the keys within each section.
100112 The default *dict_type * is :class: `collections.OrderedDict `.
101113
102114
115+ .. exception :: Error
116+
117+ Base class for all other configparser exceptions.
118+
119+
103120.. exception :: NoSectionError
104121
105122 Exception raised when a specified section is not found.
@@ -331,10 +348,13 @@ The :class:`ConfigParser` class extends some methods of the
331348
332349.. method :: ConfigParser.get(section, option, raw=False, vars=None)
333350
334- Get an *option * value for the named *section *. All the ``'%' `` interpolations
335- are expanded in the return values, based on the defaults passed into the
336- constructor, as well as the options *vars * provided, unless the *raw * argument
337- is true.
351+ Get an *option * value for the named *section *. If *vars * is provided, it
352+ must be a dictionary. The *option * is looked up in *vars * (if provided),
353+ *section *, and in *defaults * in that order.
354+
355+ All the ``'%' `` interpolations are expanded in the return values, unless the
356+ *raw * argument is true. Values for interpolation keys are looked up in the
357+ same manner as the option.
338358
339359
340360.. method :: ConfigParser.items(section, raw=False, vars=None)
0 commit comments