@@ -462,7 +462,8 @@ the :meth:`__init__` options:
462462
463463 Please note: there are ways to add a set of key-value pairs in a single
464464 operation. When you use a regular dictionary in those operations, the order
465- of the keys may be random. For example:
465+ of the keys will be ordered because dict preserves order from Python 3.7.
466+ For example:
466467
467468 .. doctest ::
468469
@@ -477,41 +478,10 @@ the :meth:`__init__` options:
477478 ... ' bar' : ' y' ,
478479 ... ' baz' : ' z' }
479480 ... })
480- >>> parser.sections() # doctest: +SKIP
481- ['section3', 'section2', 'section1']
482- >>> [option for option in parser[' section3' ]] # doctest: +SKIP
483- ['baz', 'foo', 'bar']
484-
485- In these operations you need to use an ordered dictionary as well:
486-
487- .. doctest ::
488-
489- >>> from collections import OrderedDict
490- >>> parser = configparser.ConfigParser()
491- >>> parser.read_dict(
492- ... OrderedDict((
493- ... (' s1' ,
494- ... OrderedDict((
495- ... (' 1' , ' 2' ),
496- ... (' 3' , ' 4' ),
497- ... (' 5' , ' 6' ),
498- ... ))
499- ... ),
500- ... (' s2' ,
501- ... OrderedDict((
502- ... (' a' , ' b' ),
503- ... (' c' , ' d' ),
504- ... (' e' , ' f' ),
505- ... ))
506- ... ),
507- ... ))
508- ... )
509- >>> parser.sections() # doctest: +SKIP
510- ['s1', 's2']
511- >>> [option for option in parser[' s1' ]] # doctest: +SKIP
512- ['1', '3', '5']
513- >>> [option for option in parser[' s2' ].values()] # doctest: +SKIP
514- ['b', 'd', 'f']
481+ >>> parser.sections()
482+ ['section1', 'section2', 'section3']
483+ >>> [option for option in parser[' section3' ]]
484+ ['foo', 'bar', 'baz']
515485
516486* *allow_no_value *, default value: ``False ``
517487
@@ -891,7 +861,7 @@ interpolation if an option used is not defined elsewhere. ::
891861ConfigParser Objects
892862--------------------
893863
894- .. class :: ConfigParser(defaults=None, dict_type=dict , allow_no_value=False, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=configparser.DEFAULTSECT, interpolation=BasicInterpolation(), converters={})
864+ .. class :: ConfigParser(defaults=None, dict_type=collections.OrderedDict , allow_no_value=False, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=configparser.DEFAULTSECT, interpolation=BasicInterpolation(), converters={})
895865
896866 The main configuration parser. When *defaults * is given, it is initialized
897867 into the dictionary of intrinsic defaults. When *dict_type * is given, it
@@ -953,10 +923,6 @@ ConfigParser Objects
953923 providing consistent behavior across the parser: non-string
954924 keys and values are implicitly converted to strings.
955925
956- .. versionchanged :: 3.7
957- The default *dict_type * is :class: `dict `, since it now preserves
958- insertion order.
959-
960926 .. method :: defaults()
961927
962928 Return a dictionary containing the instance-wide defaults.
@@ -1213,7 +1179,7 @@ ConfigParser Objects
12131179RawConfigParser Objects
12141180-----------------------
12151181
1216- .. class :: RawConfigParser(defaults=None, dict_type=dict , \
1182+ .. class :: RawConfigParser(defaults=None, dict_type=collections.OrderedDict , \
12171183 allow_no_value=False, *, delimiters=('=', ':'), \
12181184 comment_prefixes=('#', ';'), \
12191185 inline_comment_prefixes=None, strict=True, \
@@ -1226,10 +1192,6 @@ RawConfigParser Objects
12261192 names, and values via its unsafe ``add_section `` and ``set `` methods,
12271193 as well as the legacy ``defaults= `` keyword argument handling.
12281194
1229- .. versionchanged :: 3.7
1230- The default *dict_type * is :class: `dict `, since it now preserves
1231- insertion order.
1232-
12331195 .. note ::
12341196 Consider using :class: `ConfigParser ` instead which checks types of
12351197 the values to be stored internally. If you don't want interpolation, you
0 commit comments