I am pleased to announce version 0.4 of the ordereddict module.
- added pickling - added optional relaxed initialisation/update (from unordered dicts) - added KVIO (Key Value Insertion Order ie. key moves to back on update) - implemented a seperate subtype sorteddict, with KSO (Key Sorted Order) You *can* specify a function for key transformation before comparison (such as string.lower) sorteddict does not have all of the ordereddict methods as some of them make no sense (eg. slice assignment, rename, setkeys)
From the blurb on ordereddict's home-page:
This is an implementation of an ordered dictionary with Key Insertion Order (KIO: updates of values do not affect the position of the key), Key Value Insertion Order (KVIO, an existing key's position is removed and put at the back).
Sorted dictionaries are also provided. Currently only with Key Sorted Order (KSO, no sorting function can be specified, but a transform function to be applied on the key before comparison can be supplied.
It implementation is directly derived from dictobject.c and its speed is 5-10% slower than dict() and 5-9 times faster than Larosa/Foord excellent pure Python implemention.
This module has been tested under: Ubuntu 7.04, gcc : Python 2.5.1 Ubuntu 7.04, gcc : Python 2.4.4 Ubuntu 6.06, gcc : Python 2.5.1 Windows XP, Visual Studio 2003: Python 2.5.1
ordereddict's home on the web is at http://www.xs4all.nl/~anthon/Python/ordereddict there you also find the links where the source can be downloaded. The .zip file there included a precompiled .pyd file for Windows.
Anthon van der Neut