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.

classification
Title: OderedDict.viewitems() does not preserve item order
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: luch, rhettinger
Priority: normal Keywords:

Created on 2010-08-17 13:14 by luch, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg114117 - (view) Author: Alexey Luchko (luch) Date: 2010-08-17 13:14
OrderedDict.viewitems() is expected to preserve item order like items() do
>>> from collections import OrderedDict
>>> d = OrderedDict([(1, 2), ("a", "b")])
>>> d.items()
[(1, 2), ('a', 'b')]

But it does not:
>>> list(d.viewitems())
[('a', 'b'), (1, 2)]
msg114146 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-08-17 19:05
The effort to backport dictviews was incomplete.
Fixed in r84148.
Thanks for the report.
History
Date User Action Args
2022-04-11 14:57:05adminsetgithub: 53835
2010-08-17 19:05:01rhettingersetstatus: open -> closed
resolution: fixed
messages: + msg114146
2010-08-17 13:47:03benjamin.petersonsetassignee: rhettinger

nosy: + rhettinger
2010-08-17 13:14:33luchcreate