This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: ChainMap doesn't preserve the order of ordered mappings
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, rhettinger, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-06-17 12:37 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg296237 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-06-17 12:37
Iterating ChainMap emits keys in mixed order even if all underlying mappings are ordered dicts (OrderedDict). Would be nice to keep the order more predictable.

This would solve issue30664. See also issue30689.
msg296258 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-06-18 04:20
Until regular dicts guarantee order, I don't want to go down this path for ChainMap which currently makes no guarantees about preserving and passing through properties of the underlying mappings.   The current implementation is short, fast, and reliable.  I don't want to trade any of those for a feature that we don't even guarantee for regular dicts.

For, I recommend going with Eric's suggestion in
Date User Action Args
2022-04-11 14:58:47adminsetgithub: 74875
2017-06-18 04:20:10rhettingersetstatus: open -> closed
resolution: not a bug
messages: + msg296258

stage: resolved
2017-06-17 12:37:08serhiy.storchakacreate