Wolfgang Scherer added the comment: Thanks, works for me.
I only noted the discrepancy and did not give it much thought. I will just implement a merge method on top of read_dict. That gives me all options that could be desired :). However, after implementing the entire compatibility layer, I found one more issue: Using self.remove_section() changes the section order during an update. I would prefer that the section be cleared instead of removed in order to preserve the section order. Since OrderedDict does indeed preserve the key order during update, I think that this does not violate the Mapping Protocol. If this is not desired, just go ahead and close the issue. See also attached example bug_configparser_update_order.py: OrderedDict does not change the order of keys upon .update(): >>> od = OrderedDict((('section1', {}), ('section2', {}))) >>> list(od.keys()) ['section1', 'section2'] >>> od.update((('section1', {}), ('section3', {}))) >>> list(od.keys()) ['section1', 'section2', 'section3'] But ConfigParser changes the order of sections upon .update(): >>> cfg = configparser.ConfigParser() >>> cfg.update((('section1', {}), ('section2', {}))) >>> cfg.sections() ['section1', 'section2'] >>> cfg.update((('section1', {}), ('section3', {}))) >>> cfg.sections() ['section2', 'section1', 'section3'] ---------- resolution: fixed -> rejected status: closed -> open Added file: http://bugs.python.org/file28514/bug_configparser_update_order.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16820> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com