classification
Title: ConfigParser to accept a custom dict to allow ordering
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: loewis, mdelliot
Priority: normal Keywords: patch

Created on 2005-12-01 17:39 by mdelliot, last changed 2006-12-03 12:02 by loewis. This issue is now closed.

Files
File name Uploaded Description Edit
ConfigParser.diff mdelliot, 2005-12-01 17:39 Unified diff of ConfigParser from Python lib 2.4.1
Messages (2)
msg49158 - (view) Author: Micah Elliott (mdelliot) Date: 2005-12-01 17:39
In many cases it is preferrable for ConfigParser to
maintain the order
in which its items were added.  This small change adds
a `customdict`
default argument to *ConfigParser's constructor to
allow users to
specify a custom dict.

A useful example is::

    from ConfigParser import ConfigParser
    ConfigParser(customdict=my_ordered_dict)

One such `my_ordered_dict` could be the ordered
dictionary "odict"
<http://www.voidspace.org.uk/python/odict.html>.

Ordered dictionaries have been a recent popular topic on
comp.lang.python, and there are a few possibilities for
implementation, so it seems best that ConfigParser just
offer a
default argument to support such customization.

I can submit a documentation patch if this idea is
accepted.
msg49159 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-12-03 12:02
Thanks for the patch; I committed it with some modifications (e.g. renaming of the parameter to dict_type). Committed as r52908.

Please include patches to the documentation and the test suite in the future.
History
Date User Action Args
2005-12-01 17:39:53mdelliotcreate