You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee=Noneclosed_at=<Date2018-06-05.23:33:57.534>created_at=<Date2018-05-14.18:18:18.612>labels= ['3.8', 'type-feature', 'library']
title='configparser should use dict instead of OrderedDict in 3.7+'updated_at=<Date2019-01-31.08:53:52.064>user='https://github.com/jreese'
The configparser module uses collections.OrderedDict as its default, but this is no longer necessary in 3.7+ due to the semantics of core dictionaries being ordered by design. configparser should just use dict by default now, instead.
Like bpo-33463, it will require a deprecation cycle. I'm not sure it's worth the hassle, but I wouldn't oppose it if someone wanted to do the work. 3.8 would be the first version where it could be added.
This use case is different from namedtuple._asdict. The type of the dictionary is for the purpose of internal storage of the parser. Unlike namedtuple._asdict, it is not exposed to the user.
The purpose of changing the default to OrderedDict in the past is not documented but implying from its properties we can deduce it was to make minimal edits to .ini files stable. This property will remain unchanged with changing the type back to dict.
The history here is this:
a dict_type was introduced by MvL in r52908 (bpo-1371075) with the motivation to allow sorting or order preservation (December 2006);
the default dict_type was changed by Raymond to OrderedDict for 3.1 in 0663a1e (March 2009); as far as I can tell there was no issue for it when that change was made.
I acknowledge that in https://bugs.python.org/issue32360 Raymond states that "can't just change the default argument for configparser" but I don't see why. ConfigParser doesn't return the dictionary to the user in any API and the new 3.6+ dictionary preserves order just as OrderedDict.