Which implementation of OrderedDict should be used in python2.6?
Asked Answered
D

1

6

As some of you may know in python2.7/3.2 we'll get OrderedDict with PEP372 however one of the reason the PEP existed was because everyone did their own implementation and they were all sightly incompatible.

So which one of the 8 current implementations in the PEP is backwards compatible with the 2.7 odict from python 2.7 in a way we can start using that now and depend on 2.7 in a couple of months?

Dilute answered 20/3, 2010 at 17:39 Comment(2)
Is there any reason you can't just pull the code for OrderedDict from 2.7a4 into its own little module for now? It doesn't look terribly involved.Planking
I'll have to try that, however note from the PEP there is a bug with the json module in py2.6 bugs.python.org/issue5381Dilute
G
3

This package (for Python 2.4 or better) claims to be "A drop-in substitute for Py2.7's new collections.OrderedDict that works in Python 2.4-2.6.", but I have not checked that claim.

Gram answered 21/3, 2010 at 1:17 Comment(1)
ohhh I totally missed that in my search in pypi. I think I searched for odict and not ordereddict. I'm pretty sure that one is the one as it's author is the same guy from the pep. I'll test it out and confirm here.Dilute

© 2022 - 2024 — McMap. All rights reserved.